Discussion:
[Sdcc-user] Get the builtin macros list?
Miklos Marton
2017-06-13 20:38:16 UTC
Permalink
Hello all,

I am trying to use the SDCC's STM8 port with the QtCreator IDE with the
QBS build system.

The QBS tries to get the predefined macros by running the compiler with
"-Wp,-dM -E -x c /dev/null" arguments (in the case of gcc):

***@lapos:~$ gcc -Wp,-dM -E -x c /dev/null
#define __SSP_STRONG__ 3
#define __DBL_MIN_EXP__ (-1021)
#define __UINT_LEAST16_MAX__ 0xffff
#define __ATOMIC_ACQUIRE 2
#define __FLT_MIN__ 1.17549435082228750797e-38F
#define __GCC_IEC_559_COMPLEX 2
#define __UINT_LEAST8_TYPE__ unsigned char
#define __SIZEOF_FLOAT80__ 16
#define __INTMAX_C(c) c ## L
#define __CHAR_BIT__ 8
#define __UINT8_MAX__ 0xff

....

Is there any similar argument list with the same could be queried in SDCC?
--
Best regards,
Miklos Marton
陳韋任
2017-07-10 11:52:15 UTC
Permalink
SDCC leverages GNU cpp I think, have you read [1] and gave it a try?

[1] http://sdcc.sourceforge.net/doc/sdccman.pdf

HTH,
chenwj
Post by Miklos Marton
Hello all,
I am trying to use the SDCC's STM8 port with the QtCreator IDE with the QBS
build system.
The QBS tries to get the predefined macros by running the compiler with
#define __SSP_STRONG__ 3
#define __DBL_MIN_EXP__ (-1021)
#define __UINT_LEAST16_MAX__ 0xffff
#define __ATOMIC_ACQUIRE 2
#define __FLT_MIN__ 1.17549435082228750797e-38F
#define __GCC_IEC_559_COMPLEX 2
#define __UINT_LEAST8_TYPE__ unsigned char
#define __SIZEOF_FLOAT80__ 16
#define __INTMAX_C(c) c ## L
#define __CHAR_BIT__ 8
#define __UINT8_MAX__ 0xff
....
Is there any similar argument list with the same could be queried in SDCC?
--
Best regards,
Miklos Marton
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sdcc-user mailing list
https://lists.sourceforge.net/lists/listinfo/sdcc-user
--
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj
Kustaa Nyholm
2017-07-13 08:01:58 UTC
Permalink
Hi,

ADCON0bits struct def seems to miss CHS bit field which is available for 18F4550 in pic18f4550.h

Also CHS0..CHS3 are missing.

Further pic18f4550.h defines GO_NOT_DONE, GO, NOT_DONE and DONE fields for ADCON0, last
of which seems wrong because the bit meaning is "go/not done" so DONE does not make sense.

Where do these definitions come from, do they have Microchip origins or is this just
a regular typo/bug in SDCC?

Should I file a bug report?

I'm using sdcc 3.4.0

wbr Kusti
Gál Zsolt
2017-07-17 20:42:52 UTC
Permalink
Hello,

The sddc headers are generated from Microchip assembly processor header
files (.inc).

Here is the source ( p18f45k50.inc ):

;----- ADCON0 Bits -----------------------------------------------------
ADON EQU H'0000'
GO_NOT_DONE EQU H'0001'

DONE EQU H'0001'

GO EQU H'0001'

NOT_DONE EQU H'0001'

another source ( p18f46k20.inc ):

;----- ADCON0 Bits -----------------------------------------------------
ADON EQU H'0000'
GO_NOT_DONE EQU H'0001'

DONE EQU H'0001'
CHS0 EQU H'0002'
CHS1 EQU H'0003'
CHS2 EQU H'0004'
CHS3 EQU H'0005'

NOT_DONE EQU H'0001'

GO_DONE EQU H'0001'

GO EQU H'0001'

I think Microchip missed the CHS bits from the .inc file and this is not
sdcc bug.

Regards,

Zsolt
Post by Kustaa Nyholm
Hi,
ADCON0bits struct def seems to miss CHS bit field which is available for
18F4550 in pic18f4550.h
Also CHS0..CHS3 are missing.
Further pic18f4550.h defines GO_NOT_DONE, GO, NOT_DONE and DONE fields for ADCON0, last
of which seems wrong because the bit meaning is "go/not done" so DONE does not make sense.
Where do these definitions come from, do they have Microchip origins or is this just
a regular typo/bug in SDCC?
Should I file a bug report?
I'm using sdcc 3.4.0
wbr Kusti
------------------------------------------------------------
------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sdcc-user mailing list
https://lists.sourceforge.net/lists/listinfo/sdcc-user
--
~~~~~~~~~~~~~~~~
http://galzsolt.zzl.org
Continue reading on narkive:
Loading...