We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I trying to include .s file into another .s file using INCLUDE directive with defined parameter, but without success.
I check 2 scenario.
Scenario 1
startup.s file:
#include "Configuration.h" #if defined (CONF_CHIP_ID_LPC1549JBD64) INCLUDE CONF_ARMHAL_STARTUPSFILE ... ; some asm code #endifEND
And "Configuration.h" file:
#define CONF_CHIP_ID_LPC1549JBD64 1#define CONF_ARMHAL_STARTUPSFILE "..\..\..\ARM_HAL\startup_LPC15xx.s"
After compile I give an error:
.....\startup.s(17): error: A1023E: File ""..\..\..\ARM_HAL\startup_LPC15xx.s"" could not be opened: No such file or directory
- Please look at double quote at filename!
Scenario 2
In "Configuration.h" file, I was changed value of CONF_ARMHAL_STARTUPSFILE parameter, to without quote :
#define CONF_CHIP_ID_LPC1549JBD64 1#define CONF_ARMHAL_STARTUPSFILE ..\..\..\ARM_HAL\startup_LPC15xx.s
....\startup.s(17): error: A1023E: File ". .\. .\. .\ARM_HAL\startup_LPC15xx . s" could not be opened: No such file or directory
- Please look at additional spaces in filename!
Please, what's wrong in C preprocessor? Is any way how to include file, defined by #define parameter?
Thank you.
This code is part of C project written in uVision IDE. Parameter "--cpreproc" is used for assembler.
ARMCC c5.06 update 5
ARMASM v5.06 update 5
Hi,
Thank you for posting about the issue you are facing, and including an example to reproduce it.
In Configuration.h, you have the following statement in Scenario 1:
Configuration.h
#define CONF_ARMHAL_STARTUPSFILE "..\..\..\ARM_HAL\startup_LPC15xx.s"
As per the documentation for the INCLUDE directive, you shouldn’t have double quotes around the file name. Therefore, you correctly changed it to the following line in Scenario 2:
INCLUDE
#define CONF_ARMHAL_STARTUPSFILE ..\..\..\ARM_HAL\startup_LPC15xx.s
In this case, the C preprocessor will correctly add spaces around the . character as it is not within double quotes. To avoid this issue, you can use one of the following workarounds:
.
##
.##.##\##.##.##\ARM_HAL\startup_LPC15xx##.##s
#define
armasm
#define CONF_ARMHAL_STARTUPSFILE startup_LPC15xx##.##s
armasm --cpreproc --cpu=Cortex-M4 -i "..\..\ARM_HAL" startup.s -o startup.o
This should enable you to proceed building your project.
Thank you!
It's working.