Issue Compiling Assembly Code in app_error_handler_gcc.c

Howdy guys,

I am using an nrf52840 and SDK version 17.1.0 alongside Keil. I just upgraded from using the arm compiler version 5 to 6, which required me to switch from the app_error_handler_keil.c file to the GCC version, app_error_handler_gcc.c. Unfortunately, the file is not building for some reason, I keep getting the following error:

../../../../../components/libraries/util/app_error_handler_gcc.c(62): error: unknown token in expression
62 | "ldr r0, =%4 \n"
| ^
<inline asm>(6): note: instantiated into assembly here
6 | ldr r0, =#16385
| ^
1 error generated.

It seems that it is having trouble processing the assembly code in that one line, and I'm not quite sure why. Any help would be appreciated.

Thanks in advance!!

Charles

Parents Reply Children
  • Hi Charles,

    Is it still possible to use Arm Compiler version 5 with an older version of Keil?

    We generally recommend using the version of the IDE that the SDK was released and tested with. For nRF5 SDK v17.1.0 and Keil, that would be MDK-ARM version 5.25.

    I am still waiting for feedback about Arm Compiler version 6 compatibility. Additionally, tomorrow, a colleague with Keil will be available, and I could ask him to check if there is a way to make app_error_handler_keil.c work instead.

    Hieu

  • I believe the old version 5 compiler does still work, but it's not really supported by Keil anymore. So I can fall back to that if necessary.

    It is possible that the only change needed for the app_error_handler_keil.c file is relatively simple. It looks like the __ASM functionality was slightly changed, so I can look into that in the meantime.

    Thanks!!

    Charles

  • I tested this on ARMv6 on my end and I see the same as you. So yes, it looks like nRF solutions became incompatible on latest Keil versions. But we deprecated the SDK with Keil solutions anyways for new projects and prototypes.

    I believe based on appnote provided by the Keil, we might be able to tweak our way to make this code compliable. But I guess this should not be your end goal here. We have absolute no tests that we have done with this compiler at our end. That includes the timings of delays or pre-calculated processing latencies that are crucial for some realtime systems to work. You also might have some issues with certification related to timing stuff on your product and suddenly you will be on your own. I strongly suggest you to revert to the older version where we have more confidence that we can assist you with the issues. 

Related