cancel
Showing results for 
Search instead for 
Did you mean: 

In Keil Assembler, detect the CPU name for conditional compiling

edillere
Associate
Posted on August 14, 2014 at 18:01

I use a single assembly module for startup, but this module may be used for different CPUs of the STM32F4xxx family.

Since some micros have more memory than others, I need to set the Heap_Size differently depending on the CPU defined in the project ''Target Device''.

I tried this:

IF :DEF: STM32F427_437xx

Heap_Size EQU value1

ELSE

Heap_Size EQU value2

ENDIF

However the first option is never taken even though I selected the target device correctly.

I have a similar construction in the C code and it works, but seems the macro name is no defined for assembly.

The idea is to make this as transparent as possible, I know I can add my own built compile option to define a name and use it but others would need to remember to change it every time and why would this be needed when Keil already knows the target device?

Any idea how to solve this? I guess if keil defines a macro automatically for C then it should do it also for assembler.

Thanks

e.
1 REPLY 1
Posted on August 14, 2014 at 18:39

Have the code read the Chip ID or Flash Size and define the memory arena at run time?

Keil doesn't know the device, the coder has to pick one, hopefully the right one, and it doesn't check the device it's programming on. I've used a small subset of the Keil CPU definitions, and they are not all correct.

Have your Project have different targets, and use different startup files. Have your coders pay attention.

The assembler has it's OWN defines, review Options -> Asm pane instead of the Options -> C/C++ pane

IF      :DEF:__MICROLIB

ENDIF

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..