Mbed forum

Mbed and the ARM assembler, .s file not being assembled

(Justin Jordan) #1


A few weeks ago a library that I have worked on stopped building due to a .s file, but nothing changed in the file.

I have been doing some digging and found that the ARM assembler doesn't support 'C' preprocessor directives unless the flag --cpreproc is used when the assembler is invoked. I am assuming this used to happen since the file uses 'C' preprocessor directives and used to build. Has anything changed recently in the build configuration for the ARM toolchain?

I have also tried using the offline build tools documented here, https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/dev_tools/cli/, and can successfully build the library with the other two toolchains; IAR GCC_ARM, but not ARM.

While experimenting with the offline tools I grabbed a snippet of where the ARM compiler appears to preprocess the .s file and then try to compile it. I am not sure if the ARM compiler invokes the assembler to do this, or how this takes place, but I did notice the --via flag being used without an '=' sign for the 'via' file. Is this correct? Please see below.

Compile: owlink.s
[DEBUG] Compile: C:\Keil_v5\ARM\ARMCC\bin\armcc -c --gnu -Otime --split_sections --apcs=interwork --brief_diagnostics --restrict --multibyte_chars --cpu=Cortex-M3 -I "C:\Keil_v5\ARM\ARMCC\include" -D__CMSIS_RTOS -D__MBED_CMSIS_RTOS_CM -D__SYSTEM_HFX=24000000 -D__CORTEX_M3 -DARM_MATH_CM3 --via ..build\MAX32600MBED\ARM.includes_1e50e440b5cf0df164a3683d7fead445.txt --preinclude=..build\MAX32600MBE
D\ARM\mbed_config.h -E -o ..build\MAX32600MBED\ARM\Masters\OwGpio.temp\owlink.o.E.s C:\Users\Justin.Jordan\Documents\svn\mbed\OneWireLibrary\mbed\trunk\fw\OneWire\Masters\OwGpio\owlink.s
[DEBUG] Return: 0
[DEBUG] Compile: C:\Keil_v5\ARM\ARMCC\bin\armcc -c --gnu -Otime --split_sections --apcs=interwork --brief_diagnostics --restrict --multibyte_chars --cpu=Cortex-M3 -I "C:\Keil_v5\ARM\ARMCC\include" -o ..build\MAX32600MBED\ARM\Masters\OwGpio\owlink.o ..build\MAX32600MBED\ARM\Masters\OwGpio.temp\owlink.o.E.s
[DEBUG] Return: 0

I can provide the whole output if it would be helpful. I appreciate any feedback on this issue.


(Justin Jordan) #2

A little more info.

The C preprocessor statements were first looking at the TARGET_MAX32600 macro to see if the correct target was being used, and then the TOOLCHAIN_BLAH macros for inserting the correct asm code for the tool chain being used.

As I mentioned, this was working fine up until about two weeks ago.

I did a little more experimenting and removed all C preprocessor directives and asm code for other toolchains, and the library builds with no warnings errors.

I then added an ARM asm IF :DEF:TARGET_MAX32600 to the file and I get the same errors again. Yes, I have the correct target selected.

It appears that starting a few weeks ago, the assembler has lost knowledge of the target macros.

Does anyone know what is going on?