Skip to content

Commit

Permalink
[bsp] Switch qemu-vexpress-a9 sample to picolibc
Browse files Browse the repository at this point in the history
This adds the necessary changes to the linker script and
then selects picolibc instead of the default (newlib).

Before:
   text	   data	    bss	    dec	    hex	filename
 561638	   2100	  84928	 648666	  9e5da	rtthread.elf

After:
   text	   data	    bss	    dec	    hex	filename
 525009	    692	  86844	 612545	  958c1	rtthread.elf

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Apr 2, 2022
1 parent 2e7d679 commit c83758b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bsp/qemu-vexpress-a9/.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ CONFIG_RT_TIMER_THREAD_STACK_SIZE=1024
#
# kservice optimization
#
# CONFIG_RT_KSERVICE_USING_STDLIB is not set
CONFIG_RT_KSERVICE_USING_STDLIB=y
CONFIG_RT_KSERVICE_USING_STDLIB_MEMCPY=y
CONFIG_RT_KSERVICE_USING_STDLIB_MEMSET=y
# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
# CONFIG_RT_USING_TINY_FFS is not set
CONFIG_RT_KSERVICE_USING_PRINTF=y
# CONFIG_RT_PRINTF_LONGLONG is not set
CONFIG_RT_DEBUG=y
CONFIG_RT_DEBUG_COLOR=y
Expand Down
17 changes: 17 additions & 0 deletions bsp/qemu-vexpress-a9/link.lds
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ SECTIONS
PROVIDE(__dtors_end__ = .);
}

. = ALIGN(8);
.tdata : {
*(.tdata)
*(.tdata.*)
*(.gnu.linkonce.td.*)
}

.tbss (NOLOAD) : {
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
}

__tdata_source = ADDR(.tdata);
__tdata_size = SIZEOF(.tdata);
__tbss_size = SIZEOF(.tbss);
__tls_size = SIZEOF(.tdata) + SIZEOF(.tbss);

. = ALIGN(8);
__data_start = .;
.data :
Expand Down
4 changes: 4 additions & 0 deletions bsp/qemu-vexpress-a9/rtconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

/* kservice optimization */

#define RT_KSERVICE_USING_STDLIB
#define RT_KSERVICE_USING_STDLIB_MEMCPY
#define RT_KSERVICE_USING_STDLIB_MEMSET
#define RT_KSERVICE_USING_PRINTF
#define RT_DEBUG
#define RT_DEBUG_COLOR

Expand Down
1 change: 1 addition & 0 deletions bsp/qemu-vexpress-a9/rtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def get_mac_address():

# only support GNU GCC compiler.
PLATFORM = 'gcc'
LIBC = 'picolibc'
EXEC_PATH = r'/usr/bin'

if os.getenv('RTT_EXEC_PATH'):
Expand Down

0 comments on commit c83758b

Please sign in to comment.