ChibiOS_16.1.4 upgrade increases code size appreciably

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
dflogeras
Posts: 235
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

ChibiOS_16.1.4 upgrade increases code size appreciably

Post 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?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ChibiOS_16.1.4 upgrade increases code size appreciably

Post 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
dflogeras
Posts: 235
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: ChibiOS_16.1.4 upgrade increases code size appreciably

Post 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.
dflogeras
Posts: 235
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: ChibiOS_16.1.4 upgrade increases code size appreciably

Post by dflogeras »

Also my math sucks, 800 bytes not 1200 bytes....
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ChibiOS_16.1.4 upgrade increases code size appreciably

Post 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
dflogeras
Posts: 235
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: ChibiOS_16.1.4 upgrade increases code size appreciably

Post 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.
dflogeras
Posts: 235
Joined: Tue Sep 03, 2013 8:16 pm
Has thanked: 8 times
Been thanked: 22 times

Re: ChibiOS_16.1.4 upgrade increases code size appreciably

Post by dflogeras »

PS, in upgrading I had to change my board.h file from STM32L1XX_MDP to STM32L152xC which might explain this?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: ChibiOS_16.1.4 upgrade increases code size appreciably

Post 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
Post Reply