diff --git a/arch/at91sam3x8e/CMakeLists.txt b/arch/at91sam3x8e/CMakeLists.txt
index b99926c..e41a8ab 100644
--- a/arch/at91sam3x8e/CMakeLists.txt
+++ b/arch/at91sam3x8e/CMakeLists.txt
@@ -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
diff --git a/arch/at91sam3x8e/config.ld b/arch/at91sam3x8e/config.ld.in
similarity index 83%
rename from arch/at91sam3x8e/config.ld
rename to arch/at91sam3x8e/config.ld.in
index 369e6f6..4d68f5f 100644
--- a/arch/at91sam3x8e/config.ld
+++ b/arch/at91sam3x8e/config.ld.in
@@ -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.
diff --git a/arch/at91sam3x8e/toolchain.cmake b/arch/at91sam3x8e/toolchain.cmake
index 9077b9b..1f6157e 100644
--- a/arch/at91sam3x8e/toolchain.cmake
+++ b/arch/at91sam3x8e/toolchain.cmake
@@ -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
 )