[FUN] Preliminary results

Discussions and support about ChibiOS/NIL, the almost nil RTOS.
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: [FUN] Preliminary results

Postby DeusExMachina » Mon Dec 09, 2013 1:17 am

There are no thread priorities in nil, right?

User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: [FUN] Preliminary results

Postby DeusExMachina » Mon Dec 09, 2013 3:11 am

I tried NIL demo for F051
RAM footprint should be bss+data, right?

Code: Select all

Creating build/ch.dmp

   text      data       bss       dec       hex   filename
   3068       192      2252      5512      1588   build/ch.elff


So, for 4k Cortex M0 Nil will occupy 2444 bytes, or 60% of RAM? There are only 3 threads, 2 blinking and one writing to serial driver.

User avatar
Giovanni
Site Admin
Posts: 14432
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 917 times
Contact:

Re: [FUN] Preliminary results

Postby Giovanni » Mon Dec 09, 2013 9:36 am

Hi,

From the map file:

Code: Select all

.stacks         0x20000000      0x500
                0x20000000                . = ALIGN (0x8)
                0x20000000                __main_stack_base__ = .
                0x20000400                . = (. + __main_stack_size__)
 *fill*         0x20000000      0x400 00
                0x20000400                . = ALIGN (0x8)
                0x20000400                __main_stack_end__ = .
                0x20000400                __process_stack_base__ = .
                0x20000400                __main_thread_stack_base__ = .
                0x20000500                . = (. + __process_stack_size__)
 *fill*         0x20000400      0x100 00
                0x20000500                . = ALIGN (0x8)
                0x20000500                __process_stack_end__ = .
                0x20000500                __main_thread_stack_end__ = .

.data           0x20000500        0x0 load address 0x08000e60
                0x20000500                . = ALIGN (0x4)
                0x20000500                PROVIDE (_data, .)
 *(.data)
                0x20000500                . = ALIGN (0x4)
 *(.data.*)
                0x20000500                . = ALIGN (0x4)
 *(.ramtext)
                0x20000500                . = ALIGN (0x4)
                0x20000500                PROVIDE (_edata, .)

.igot.plt       0x20000500        0x0 load address 0x08000e60
 .igot.plt      0x00000000        0x0 build/obj/nilcoreasm_v6m.o

.bss            0x20000500      0x3c8 load address 0x08000e60
                0x20000500                . = ALIGN (0x4)
                0x20000500                PROVIDE (_bss_start, .)
 *(.bss)
                0x20000500                . = ALIGN (0x4)
 *(.bss.*)
 .bss.waThread3.4505
                0x20000500       0xf8 C:\Users\disiriog\AppData\Local\Temp\cc3mKP2N.ltrans0.ltrans.o
 .bss.SD1.4451  0x200005f8       0x7c C:\Users\disiriog\AppData\Local\Temp\cc3mKP2N.ltrans0.ltrans.o
 *fill*         0x20000674        0x4 00
 .bss.waThread2.4504
                0x20000678       0xf8 C:\Users\disiriog\AppData\Local\Temp\cc3mKP2N.ltrans0.ltrans.o
 .bss.waThread1.4499
                0x20000770       0xf8 C:\Users\disiriog\AppData\Local\Temp\cc3mKP2N.ltrans0.ltrans.o
 .bss.nil.4465  0x20000868       0x60 C:\Users\disiriog\AppData\Local\Temp\cc3mKP2N.ltrans0.ltrans.o
                0x200008c8                . = ALIGN (0x4)
 *(COMMON)
                0x200008c8                . = ALIGN (0x4)
                0x200008c8                PROVIDE (_bss_end, .)


The BSS is just 968 bytes, the whole RAM used is 2248 including the two stacks and data. You may trim stacks down for sure.
Of the above, you would have main and process stacks with or without operating system, same for the space used by device drivers.

Giovanni

User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Location: South Korea
Has thanked: 3 times
Been thanked: 3 times

Re: [FUN] Preliminary results

Postby DeusExMachina » Wed Dec 11, 2013 12:31 am

But in test report from chibios demo for same MCU we get

Code: Select all

--- Test Case 11.13 (Benchmark, RAM footprint)
--- System: 404 bytes
--- Thread: 72 bytes
--- Timer : 20 bytes
--- Semaph: 12 bytes
--- EventS: 4 bytes
--- EventL: 16 bytes
--- Mutex : 16 bytes
--- CondV.: 8 bytes
--- Queue : 36 bytes
--- MailB.: 40 bytes
--- Result: SUCCESS

Total we get 628 bytes for Chibios kernel. The difference is not so dramatic? I just want to figure out what I should use with Cortex M0 4k of RAM.

User avatar
Giovanni
Site Admin
Posts: 14432
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 917 times
Contact:

Re: [FUN] Preliminary results

Postby Giovanni » Wed Dec 11, 2013 9:37 am

The Nil numbers include also the HAL and the space for threads, the ChibiOS report only shows object sizes.

For example a Thread is 64+bytes in ChibiOS and 20bytes in Nil, a semaphore 12 vs 4 etc. It is much smaller.

Giovanni

pcharest
Posts: 1
Joined: Thu Feb 13, 2014 12:14 am

Re: [FUN] Preliminary results

Postby pcharest » Thu Feb 13, 2014 12:24 am

Giovani,

Thankyou for your great work, I have used your RTOS on atmega 328 with great succes memory was not issue . But now I have compiled the latest svn version (kernel_3_dev) on an attiny44... now memory usage is an issue... In your previous post you state "For example a Thread is 64+bytes in ChibiOS and 20bytes in Nil, a semaphore 12 vs 4 etc. It is much smaller." I am getting diiferent results, here is the map file:

Running one thread 8 bytes allocated for the working area..... I am getting much higher ram usage than what I expected. Do you have an idea what is going on? Runing two threads is thus out of the question!


Allocating common symbols
Common symbol size file

isRunning 0x1 ./src/display_clock.o
r_value 0x1 ./src/softpwm.o
digit_array 0x5 ./src/display_clock.o
waAnimate_led 0x55 ./src/main.o
nil 0x1e ./src/NilRTOS/nil.o
current_vfd__brigthness
0x1 ./src/display_clock.o
prev_m_led 0x2 ./src/display_clock.o
current_m_led 0x2 ./src/display_clock.o
g_value 0x1 ./src/softpwm.o
b_value 0x1 ./src/softpwm.o
millis 0x2 ./src/swRTC.o

User avatar
Giovanni
Site Admin
Posts: 14432
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 917 times
Contact:

Re: [FUN] Preliminary results

Postby Giovanni » Thu Feb 13, 2014 9:34 am

There are new feature in nil. If you need to minimize space then disable NIL_CFG_USE_EVENTS and NIL_CFG_ENABLE_STACK_CHECK.

You may also reduce PORT_INT_REQUIRED_STACK if your ISRs don't use much stack.

Giovanni


Return to “ChibiOS/NIL”

Who is online

Users browsing this forum: No registered users and 2 guests