I am writing FLASH code that will work on both a medium and high density STM32 chip. Is there a simple way of selecting the FLASH and PAGE size in my code with out me having two versions of a header file. In other words are there processor configuration #defines that tell me the processor type or better still the flash and page sizes that I can access at compile time.
I'm using Uvision 3 and the two processors I m targetting are STM32F101VB and ..103VE
Thanks
No - this is a very long-standing deficiency of uVision.
:-(
Dunno if it's possible in the new UV4, though...
So I guess from that answer that there is not a way of pulling this from the processor type selected on the Device tab? Is this define stored in the Project file? Ok thanks I'll use this method. Cheers.
Create two targets.
For each target, select the C/C++ tab. In the field Define, you add a suitable preprocessor define.
In the source code, you use conditional compilation depending on the value of your define.
#if PROCESSOR_BIG_BAUTA // Building for xxx #include <xxx> #elif PROCESSOR_TINY // Building for yyy #include <yyy> #else // Oops, unsupported or missing choice #error "No known target specified" #endif
View all questions in Keil forum