cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2xx and STM32F4xx Demonstration Builder Compile

wmoyne
Associate II
Posted on November 02, 2012 at 18:18

I am having difficulty compiling the Demonstration Builder example code.  I am using MDK-ARM (Keil) with the 256k license but the code is 265k when linked.  I read the app note to disable modules but when I tried to eliminate the ''audio'' module, I got errors from other modules complaining about missing audio functions such as ''AUDIO_ForceStop'' referenced in mod_serial.o.

So, I really don't want to heavily edit the example code since I just want to poke around it, but it seems a bit less modular than advertised.  Also, at least in Keil tools, the project has 3 directories with ''Appli'' containing 50+ *.c files in no particular order (i.e. alphabetical) so removing a module is non-intuitive.

So, how do I remove a module, or at least get the link size under 256k?  The compiler is set to max optimization and remove ''debug'' doesn't seem to help.

#stm32f2xx-stm32f4xx-module
3 REPLIES 3
frankmeyer9
Associate II
Posted on November 02, 2012 at 19:44

I usually don't use Keil.

But if you are sure that you don't need this functionality, you can replace this function with dummy code.

Just comment comment out the function body, and place a

return <x>;

at the begin instead. The value <x> depends on the return value, of course.

wmoyne
Associate II
Posted on November 02, 2012 at 19:56

I've done something similar by eliminating the calls contained in the other modules, but I was hoping that someone (ST?) who worked/wrote the demo app would explain the ''right'' way to remove a module.  It defeats the purpose of creating modules if they are all depend on each other.  

Ideally, I'd like to compile the code with only the module I'm interested in working with such as Ethernet or USB while leaving the other ones disabled.

Posted on November 02, 2012 at 21:07

Not sure you're going to get any ST software engineering guys here, mostly end users.

Would suggest you look at the size of the .O (object) files, and get a feel for where the bulk of the data is coming from, like bitmaps or something.

Running at -O3 tends to help reduce code size, one ELF section per function will allow for better dead code elimination by the linker.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..