From c33c2bf04e3a8288d79b55cf95206a34b33b6ccf Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 3 Apr 2023 15:49:14 -0700 Subject: [PATCH] picolibc: Allow default memory layout values to be configured These values are used when constructing the default linker scripts used with picolibc. Setting reasonable defaults allows simple test applications to be compiled without additional configuration. Signed-off-by: Keith Packard --- config/libc/picolibc.in | 40 ++++++++++++++++++++ scripts/build/companion_libs/340-picolibc.sh | 4 ++ 2 files changed, 44 insertions(+) diff --git a/config/libc/picolibc.in b/config/libc/picolibc.in index cd6da1ed..6c4c6cac 100644 --- a/config/libc/picolibc.in +++ b/config/libc/picolibc.in @@ -123,3 +123,43 @@ config LIBC_PICOLIBC_EXTRA_CONFIG_ARRAY default "" help Extra flags to pass to meson when configuring picolibc. + +config LIBC_PICOLIBC_DEFAULT_FLASH_ADDR + string + prompt "Default flash address for picolibc.ld" + default "0x10000000" + help + Sets the default base adddress for the read-only portion of the + application when linked using the default picolibc link + script. Can be overridden on the linker command line using + -Wl,--defsym=__flash= + +config LIBC_PICOLIBC_DEFAULT_FLASH_SIZE + string + prompt "Default flash size for picolibc.ld" + default "0x00010000" + help + Sets the default size for the read-only portion of the + application when linked using the default picolibc link script. + Can be overridden on the linker command line using + -Wl,--defsym=__flash_size= + +config LIBC_PICOLIBC_DEFAULT_RAM_ADDR + string + prompt "Default ram address for picolibc.ld" + default "0x20000000" + help + Sets the default base adddress for the read-write portion of the + application when linked using the default picolibc link + script. Can be overridden on the linker command line using + -Wl,--defsym=__ram= + +config LIBC_PICOLIBC_DEFAULT_RAM_SIZE + string + prompt "Default ram size for picolibc.ld" + default "0x00008000" + help + Sets the default size for the read-write portion of the + application when linked using the default picolibc link script. + Can be overridden on the linker command line using + -Wl,--defsym=__ram_size= diff --git a/scripts/build/companion_libs/340-picolibc.sh b/scripts/build/companion_libs/340-picolibc.sh index 929babf0..0b2038e6 100644 --- a/scripts/build/companion_libs/340-picolibc.sh +++ b/scripts/build/companion_libs/340-picolibc.sh @@ -82,6 +82,10 @@ endian = '${CT_ARCH_ENDIAN}' c_args = [ ${meson_cflags} '-nostdlib', '-fno-common', '-ftls-model=local-exec' ] needs_exe_wrapper = true skip_sanity_check = true +default_flash_addr = '${CT_LIBC_PICOLIBC_DEFAULT_FLASH_ADDR}' +default_flash_size = '${CT_LIBC_PICOLIBC_DEFAULT_FLASH_SIZE}' +default_ram_addr = '${CT_LIBC_PICOLIBC_DEFAULT_RAM_ADDR}' +default_ram_size = '${CT_LIBC_PICOLIBC_DEFAULT_RAM_SIZE}' EOF local picolibc_sysroot_dir