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

Richard Weickelt richard at weickelt.de
Fri Feb 22 07:33:10 CET 2019


 
> 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:

Unlike your IAR implementation, I wouldn't probe the compiler and guess qbs.architecture. Instead I would expect the user to set qbs.architecture in the profile or in the product explicitly. I could be wrong, but I think that was the approach for all toolchains before probes were invented.
 
> 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/
> 
>


More information about the Qbs mailing list