Page 1 of 1
ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Wed Apr 20, 2016 9:59 pm
by dflogeras
Hi, just tried a direct upgrade from an existing firmware that I had been using with 3.0.4. When I compiled it against 16.1.4, the resulting binary went from 50k to about 61k.
Is this expected? Is it most likely that something in my [hal/mcu/ch]conf.h needs to be updated to exclude a new feature? If so what should I watch out for? I was under the impression that 16.x.y was just a new numbering scheme and is functionally similar to 3.x series. Is there a porting guide I should follow?
Re: ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Wed Apr 20, 2016 10:48 pm
by Giovanni
Hi,
There should be not such a difference, kernel only got minor changes.
Could you look at the map file and see what changed? also, is the compiler the same?
Giovanni
Re: ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Thu Apr 21, 2016 12:24 pm
by dflogeras
Yup same development environment.
After looking at the map files (I'm not great at reading these) I don't see anything hugely suspect. However I did notice this:
The output from building my project with ChibiOS_3.0.4
Code: Select all
text data bss dec hex filename
43720 2836 4372 50928 c6f0 build/ch.elf
Creating build/ch.list
and from 16.1.4:
Code: Select all
text data bss dec hex filename
44472 2900 13864 61236 ef34 build/ch.elf
Creating build/ch.list
However, the resulting .bin files are 46556 and 47373 bytes respectively, so only about 1200 bytes larger. Now a lot of the difference is in the .bss section, which I guess would be uninitialized RAM and wouldn't show up in the .bin file? How can I read these map files better, a diff is only giving me a 30000 mile view.
Re: ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Thu Apr 21, 2016 12:26 pm
by dflogeras
Also my math sucks, 800 bytes not 1200 bytes....
Re: ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Thu Apr 21, 2016 12:44 pm
by Giovanni
Hi,
In 16.1.x the size of the heap is included in the BSS by that tool. It is not the real size of the BSS. This is caused by a change in linker scripts.
Trust the segment sizes as shown in the map file.
Giovanni
Re: ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Thu Apr 21, 2016 1:09 pm
by dflogeras
Ah I see.
So if I am reading the map file correctly, it seems the rest of the 800 odd bytes in the .text and .data segments seems to be coming from a newly introduced file hal_buffers.o(c) and some new stm32_dma related vectors (84, 108, 10C, 110, 114, 118). Is this all to be expected? I'm not trying to nitpick, just trying to better understand if I am reading this correctly and upgrading properly.
Re: ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Thu Apr 21, 2016 1:12 pm
by dflogeras
PS, in upgrading I had to change my board.h file from STM32L1XX_MDP to STM32L152xC which might explain this?
Re: ChibiOS_16.1.4 upgrade increases code size appreciably
Posted: Thu Apr 21, 2016 3:15 pm
by Giovanni
dflogeras wrote:PS, in upgrading I had to change my board.h file from STM32L1XX_MDP to STM32L152xC which might explain this?
No, this is unrelated.
Giovanni