ChibiOS 3 vs 16 Code size

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

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
MobileWill
Posts: 27
Joined: Sat Jan 30, 2016 8:44 am

ChibiOS 3 vs 16 Code size

Post by MobileWill »

Hi,

I have been doing testing to use ChibiOS for a new project with the STM32F411RE and eventually will be testing with a graphics library like uGFX.

After many hours I finally got it working. The 2nd try using this basic premade project http://www.emblocks.org/forum/viewtopic ... 48&start=3 I was able to convert it to STM32F411 from 407.

The questions I have is why size difference with version 16. I converted it from 3 to 16 and here are the results.

3

Code: Select all

bin\Debug\STM32F4disco_ChibiOS3.map|1|Program size (bytes):   10200|
||Data size    (bytes):     456|
||BSS size     (bytes):    3176|
||             ----------------|
||Total size   (bytes):   13832   (R/W Memory: 3632)|
|||
||=== Build finished: 0 errors, 0 warnings (0 minutes, 5 seconds) ===|


16

Code: Select all

bin\Debug\STM32F411RE_ChibiOS16.map|1|Program size (bytes):   10440|
||Data size    (bytes):     520|
||BSS size     (bytes):  131072|
||             ----------------|
||Total size   (bytes):  142032   (R/W Memory: 131592)|
|||
||=== Build finished: 0 errors, 0 warnings (0 minutes, 6 seconds) ===|



Am I missing something or is that correct? It seems the final .bin file is 11kb from both. Should I attach the map files?

Thanks for the help. I hope to get the graphics tested this weekend.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS 3 vs 16 Code size

Post by Giovanni »

Hi,

The new linkers scripts allocate all the unused memory to an heap section. The tool incorrectly reports the heap section as BSS so the apparent size is always the full RAM.

Look for real sizes in the map file.

Giovanni
MobileWill
Posts: 27
Joined: Sat Jan 30, 2016 8:44 am

Re: ChibiOS 3 vs 16 Code size

Post by MobileWill »

Thank you. I won't worry about it then. Now to get uGFX working.
Alexte
Posts: 27
Joined: Sun Jul 01, 2012 1:24 pm

Re: ChibiOS 3 vs 16 Code size

Post by Alexte »

I compiled a simple example.
Chibios 162 is more compact.

Code: Select all

#include "ch.h"
#include "hal.h"


static THD_WORKING_AREA(waThread1, 128);
static THD_FUNCTION(Thread1, arg) {

  (void)arg;
  chRegSetThreadName("blinker");
  while (true) {
    palSetPad(GPIOD, GPIOD_LED3);       /* Orange.  */
    chThdSleepMilliseconds(500);
    palClearPad(GPIOD, GPIOD_LED3);     /* Orange.  */
    chThdSleepMilliseconds(500);
  }
}

int main(void) {

  halInit();
  chSysInit();

  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  while (true) {
    chThdSleepMilliseconds(500);
  }
}


Chibios 305

Code: Select all

   text      data       bss       dec       hex   filename
   7128       448      3344     10920      2aa8   build/ch.elf
 
ch.dmp
   Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 startup       000001c0  08000000  08000000  00008000  2**4
                  CONTENTS, ALLOC, LOAD, DATA
  1 .text         00001bd8  080001c0  080001c0  000081c0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .mstack       00000400  20000000  20000000  00010000  2**0
                  ALLOC
  3 .pstack       00000400  20000400  20000400  00010000  2**0
                  ALLOC
  4 .bss          00000510  20000800  08001d98  00010800  2**3
                  ALLOC


Chibios 162

Code: Select all

   text      data       bss       dec       hex   filename
   4800       512    131072    136384     214c0   build/ch.elf

ch.dmp
   Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 startup       00000200  08000000  08000000  00008000  2**7
                  CONTENTS, ALLOC, LOAD, DATA
  1 .text         000012c0  08000200  08000200  00008200  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  2 .mstack       00000400  20000000  20000000  00010000  2**0
                  ALLOC
  3 .pstack       00000400  20000400  20000400  00010000  2**0
                  ALLOC
  4 .bss          0000033c  20000800  080014c0  00010800  2**3
                  ALLOC
  5 .heap         0001f4c4  20000b3c  20000b3c  00010000  2**0
                  ALLOC
Post Reply