[Qbs] bare-metal: Need help with adding of SDCC compiler

Denis Shienkov denis.shienkov at gmail.com
Thu Feb 21 20:52:35 CET 2019


Hi guys.

I have planns to add support for SDCC [1] compiler to QBS/QtC for 
bare-metal devices.

But problem is that this compiler supports multiple different arcitectures:

c:\SDCC\bin>sdcc -v
SDCC : 
mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 
3.8.0 #10562 (MINGW32)
published under GNU General Public License (GPL)

The target architecture is specified trough the flag -m<arch>... So, in 
different cases we wil get a different predefined macroses, e.g:

=== MCS51 ===

c:\SDCC\bin>sdcc -dM -E -mmcs51 e:\git\ng\git\123\qbs-git\main.c
#define __SDCC_mcs51 1
#define __STDC_VERSION__ 201112L
#define __STDC_HOSTED__ 0
#define __STDC_UTF_16__ 1
#define __SDCC_VERSION_MINOR 8
#define __SDCC_MODEL_SMALL 1
#define __STDC_ISO_10646__ 201409L
#define __SDCC_VERSION_PATCH 0
#define SDCC 380
#define __SDCC_FLOAT_REENT 1
#define __SDCC_VERSION_MAJOR 3
#define __STDC_NO_VLA__ 1
#define __SDCC 3_8_0
#define __STDC_UTF_32__ 1
#define __STDC_NO_THREADS__ 1
#define __SDCC_CHAR_UNSIGNED 1
#define __STDC_NO_ATOMICS__ 1
#define __STDC__ 1
#define __SDCC_REVISION 10562
#define __STDC_NO_COMPLEX__ 1

=== Z80 ===

c:\SDCC\bin>sdcc -dM -E -mz80 e:\git\ng\git\123\qbs-git\main.c
#define __STDC_VERSION__ 201112L
#define __SDCC_INT_LONG_REENT 1
#define __STDC_HOSTED__ 0
#define __STDC_UTF_16__ 1
#define __SDCC_VERSION_MINOR 8
#define __SDCC_z80 1
#define __STDC_ISO_10646__ 201409L
#define __SDCC_VERSION_PATCH 0
#define __SDCC_FLOAT_REENT 1
#define __SDCC_VERSION_MAJOR 3
#define __STDC_NO_VLA__ 1
#define __SDCC 3_8_0
#define __STDC_UTF_32__ 1
#define __STDC_NO_THREADS__ 1
#define __SDCC_CHAR_UNSIGNED 1
#define __STDC_NO_ATOMICS__ 1
#define __SDCC_STACK_AUTO 1
#define __STDC__ 1
#define __SDCC_REVISION 10562
#define __STDC_NO_COMPLEX__ 1

and etc.

So, it is problematic to define a compiler ABI and etc...

Has anybody any suggestions how to solve this? Is any similar cases in 
QtC/QBS?

Because I have not ideas...

BR, Denis


[1] http://sdcc.sourceforge.net/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20190221/ef017707/attachment.html>


More information about the Qbs mailing list