Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 9 months ago.
Keil Evaluaton useless as limit is too small for blinky
I just tried exporting mbed-os-example-blinky into the Keil Evaluation version, and met with instant failure, as the binary generated on compiling in Keil is 52kB, which exceeds the evaluation limit.
This immediately raises 2 questions.
(1) why is the blinky example so large when compiled?
(2) what is the point of the Keil Evaluation edition if the most trivial example imaginable exceeds the evaluation limit?
How can we possibly evaluate Keil in conjunction with mbed under these circumstances?
3 Answers
6 years, 9 months ago.
Keep in mind the limits on the evaluation edition are for all projects not just mbed ones. I have a non-mbed project on an STM32 board that despite using the ARM DSP libraries, printf and a fair about of other code is using a total of 56k of flash. A far simpler mbed-2 application using the same libraries is 108k.
Mbed 2 and Mbed-os both add a lot of overhead, especially on parts with more flash where they default to using more complete libraries rather than the smaller microLib c library used on parts with less memory.
If you take a look at https://os.mbed.com/blog/entry/Optimizing-memory-usage-in-mbed-OS-52/ and https://os.mbed.com/blog/entry/Reducing-memory-usage-with-a-custom-prin/ there are some pointers there on how to reduce memory usage.
But as to your main point, yes, the evaluation version isn't much use for mbed on the more capable platforms. Who wants to jump through hoops making code smaller in order to evaluate a compiler.
It seems to me that stuff is getting included in the binary whether it is used or not, perhaps. Surely dead code should be stripped? Or if the code is not dead, why not, for such a simple example?
Point taken that you don't have to use mbed. But if ARM are serious about getting us to use it, they should provide appropriate tools...
posted by 07 Feb 2018Some of it is code that's not normally needed but not dead as far as the compiler is concerned.
If the library encounters a run time config error, e.g. you've tried to use a non-analog in pin as an analog input, then it prints out an error message on standard output. Standard output on most platforms is defined as the uart connected to the usb serial port. Which means a program that is just flashing an LED still includes the code for uarts (fairly minimal) and the c libraries needed for printf (>20k).
posted by 08 Feb 20186 years, 9 months ago.
One idea, you can save a lot of space by using Microlib and keeping things in a single thread. But I won't promise this will get you in under the limit. Mbed 2 I think was a bit smaller, you could roll back to that. And there is a free version of Keil for STM32 M0 parts as well that goes up to I think 256k - so you could try one of the M0 boards. Your basic point though is fair, that's a very small limit given the binaries that mbed produces. http://www2.keil.com/stmicroelectronics-stm32/mdk
Thanks for pointing out the free version for those other boards. But why do STM stop there?
posted by 07 Feb 2018Keil needs to make a living too, although they are owned by ARM.
Note that STM acquired Atollic last year and they have recently released a free, unlimited version of Atollic TrueStudio for STM32. See here
posted by 07 Feb 20186 years, 9 months ago.
You can use the free openocd/gcc/gdb offline compiler for developing, however the Keil MDK produces about 40% smaller and much faster code (is the same Compiler as the mbed online compiler). When needed, it is probably time your you to purchase the Keil MDK version.
I have just wasted 2 days trying to get the free openocd/gcc/gdb offline compiler working, due to things missing in the documentation, things not working like the documentation says, etc. While I do now have it working (using Visual Studio Code). and while I don't "need" Keil, it would be nice if (i) the free tools actually worked as stated, and (2) the tryout version of Keil actually let you make a minimum program with mbed - assuming ARM are trying to encourage people to use it.
Ultimately, I just don't get why any of these development tools are not provided for free by the manufacturers - don't they want to encourage people to use their chips (or cores)? The cost is trivial for a big manufacturer of white goods or phones, but not for someone who occasionally develops something. The costs of the development tools ought to be amortised as an extra penny or two per chip. The development boards have come down from the hundreds of pounds they used to be to now a mere £10 or so. Why not the tools too?
I note more enlightened manufactuerers DO offer free tools (Cypress, Microchip). I dont understand STM's strategy of providing Keil free for STM32f0 series chips only.
posted by 08 Feb 2018you are completely wrong, here are a few facts:
- None of the sample board vendors earns money with it, it is sold as a promotional tool to get things starting.
- The free mbed platform (but costly for ARM) offers everything to get startet with easy sample programs, the ARM compiler which creates fast and compact code, the IDE benefits are great and not to forget a mbed-os (which is also open source)
- The MCU vendors cannot develop compilers, but great hardware, therefore Keil MDK and IAR as well GCC can be used.
- If you seriously interested in spending the 3,5k Euro for the Keil MDK, give them a call I believe they have options to provide you a 30 day unlimited test drive.
- I got the openocd, gcc/gdb setup running on a Mac and I am happy to assist you a days or two (of course for my daily rate)
posted by 09 Feb 2018