build: parameterize STACK_SIZE in linker script

This commit is contained in:
anna 2021-08-01 01:26:16 +02:00
parent 8f424d49e8
commit c2538b4516
Signed by: fef
GPG key ID: EC22E476DC2D3D84
3 changed files with 10 additions and 7 deletions

View file

@ -6,6 +6,11 @@ target_link_libraries(ardix INTERFACE ardix_arch)
target_compile_options(ardix_arch PRIVATE ${ARDIX_COMPILE_OPTIONS})
target_include_directories(ardix_arch PRIVATE ${ARDIX_INCLUDE_DIRS})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.ld.in
${CMAKE_BINARY_DIR}/config.ld # see toolchain.cmake
)
target_sources(ardix_arch PRIVATE
atom_get_put.S
atom.c

View file

@ -1,10 +1,7 @@
/* See the end of this file for copyright, license, and warranty information. */
/*
* stack size is 8K
* TODO: modify flash.ld to actually align this properly
*/
STACK_SIZE = 0x2000;
/* TODO: modify flash.ld to actually align this properly */
STACK_SIZE = @CONFIG_STACK_SIZE@;
/*
* This file is part of Ardix.

View file

@ -21,9 +21,10 @@ if(DEBUG)
set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}")
endif()
set(CMAKE_LINKER_FLAGS "-T${CMAKE_CURRENT_LIST_DIR}/config.ld -T${CMAKE_CURRENT_LIST_DIR}/flash.ld --whole-archive")
# see CMakeLists.txt for config.ld generation
set(CMAKE_LINKER_FLAGS "-T${CMAKE_BINARY_DIR}/config.ld -T${CMAKE_CURRENT_LIST_DIR}/flash.ld --whole-archive")
set(ARDIX_LINKER_FLAGS
-T${CMAKE_CURRENT_LIST_DIR}/config.ld
-T${CMAKE_BINARY_DIR}/config.ld
-T${CMAKE_CURRENT_LIST_DIR}/flash.ld
--whole-archive
)