[Scons-users] Fwd: question about incorrect command format in Scons

Bill Deegan bill at baddogconsulting.com
Tue Jun 13 15:02:34 EDT 2023


Email mistakenly sent to scons-dev-owner..

---------- Forwarded message ---------
From: Bill Deegan <bill at baddogconsulting.com>
Date: Mon, Jun 12, 2023 at 10:05 PM
Subject: Re: question about incorrect command format in Scons
To: mzhou <mzhou_sh at 163.com>
Cc: <scons-dev-owner at scons.org>


Please send to scons users mailing list

On Mon, Jun 12, 2023 at 12:43 AM mzhou <mzhou_sh at 163.com> wrote:

> Hi
> I have been trying to build an ARM-GCC Cortex-M0 compilation and linking environment using SCons on Windows. However, I encountered an issue
> when
> modifying the necessary compilation and linking variables through the SCons custom Tool in the generate interface.
> ------------------------------
> #arm-gcc.py
> def generate(env):
>     env['CC'] = 'arm-none-eabi-gcc'
>     env['CXX'] = 'arm-none-eabi-g++'
>     env['AS'] = 'arm-none-eabi-gcc'
>     env['AR'] = 'arm-none-eabi-gcc-ar'
>     env['OBJDUMP'] = 'arm-none-eabi-objdump'
>     env['OBJCOPY'] = 'arm-none-eabi-objcopy'
>     env['NM'] = 'arm-none-eabi-nm'
>     env['READELF'] = 'arm-none-eabi-readelf'
>     env['PROGSUFFIX'] = '.elf'
>     # env['OBJSUFFIX'] = '.o'
>
> def exists(env):
>     return True
> ------------------------------
> In Sconscript, Tool is used like:
> ------------------------------
> #Sconscript
> tool = ARGUMENTS.get('tool','arm-gcc')
> env.Tool(tool,toolpath = ['$SDK_ROOT/tools'])
> if tool == 'arm-gcc':
>     env['COMPILER'] = 'gnu'
>
>     env['CCFLAGS'] = ' -mabi=aapcs -mthumb -mcpu=$CPU -mno-unaligned-access -fshort-enums -fshort-wchar -g -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-common -Wall '
>     env['CFLAGS'] = ' -std=c11 '
>     env['CXXFLAGS'] = ' -fno-exceptions '
>     env['ASFLAGS'] = ' -c ${CCFLAGS} ${_CPPDEFFLAGS} '
>
>     env['LINKFLAGS'] = ' -mcpu=$CPU -g -specs=nosys.specs -specs=nano.specs -T ${LINKSCRIPT} -Wl,--print-memory-usage -Wl,-Map=${TARGET.base}.map -Wl,--cref -Wl,--no-wchar-size-warning -Wl,--no-enum-size-warning  '
>     env['GC_OPTION'] = ' -Wl,--gc-sections '
> ------------------------------
> When running Scons, the compiling format seems incorrect:
>
>
> arm-none-eabi-gcc /Fobuild\device\__\__\__\__\soc\arm_cm\svcall.obj /c D:\code\SDK\soc\arm_cm\svcall.c -std=c11 -mabi=aapcs -mthumb -mcpu=cortex-m0 -mno-unaligned-access -fshort-enums -fshort-wchar -g -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-common -Wall -Os
>
> It should be like:
>
> arm-none-eabi-gcc -o build\device\__\__\__\__\soc\arm_cm\svcall.o -c -std=c11 -mabi=aapcs -mthumb -mcpu=cortex-m0 -mno-unaligned-access -fshort-enums -fshort-wchar -g -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -fno-common -Wall -Os D:\code\SDK\soc\arm_cm\svcall.c
>
>
> It seems that my compilation command format is incorrect, as SCons is using the Windows platform's compilation command format (/Fo). I would like to know how to handle this situation.
>
> I have attempted to read all available documentation on SCons and searched relevant issues on Google, but I have not been able to find an answer.
> Looking forward to your answer, thanks a lot~
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20230613/6a441702/attachment.htm>


More information about the Scons-users mailing list