diff options
Diffstat (limited to 'ports/cortex_m0/gnu')
| -rw-r--r-- | ports/cortex_m0/gnu/example_build/build_threadx.bat | 5 | ||||
| -rw-r--r-- | ports/cortex_m0/gnu/example_build/build_threadx_sample.bat | 6 | ||||
| -rw-r--r-- | ports/cortex_m0/gnu/example_build/cortexm0_crt0.S (renamed from ports/cortex_m0/gnu/example_build/cortexm0_crt0.s) | 8 | ||||
| -rw-r--r-- | ports/cortex_m0/gnu/example_build/cortexm0_vectors.S (renamed from ports/cortex_m0/gnu/example_build/tx_vectors.s) | 33 | ||||
| -rw-r--r-- | ports/cortex_m0/gnu/example_build/sample_threadx.ld | 267 |
5 files changed, 101 insertions, 218 deletions
diff --git a/ports/cortex_m0/gnu/example_build/build_threadx.bat b/ports/cortex_m0/gnu/example_build/build_threadx.bat index c74b194e..dbcac3a5 100644 --- a/ports/cortex_m0/gnu/example_build/build_threadx.bat +++ b/ports/cortex_m0/gnu/example_build/build_threadx.bat @@ -1,5 +1,4 @@ del tx.a -arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb tx_initialize_low_level.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_thread_stack_build.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_thread_schedule.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_thread_system_return.S @@ -7,7 +6,7 @@ arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_thread_context_save.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_thread_context_restore.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_thread_interrupt_control.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_timer_interrupt.S -arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb ../src/tx_thread_interrupt_control.S + arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../inc ../../../../common/src/tx_block_allocate.c arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../inc ../../../../common/src/tx_block_pool_cleanup.c arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../inc ../../../../common/src/tx_block_pool_create.c @@ -192,8 +191,8 @@ arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../in arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../inc ../../../../common/src/txe_timer_deactivate.c arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../inc ../../../../common/src/txe_timer_delete.c arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../inc ../../../../common/src/txe_timer_info_get.c + arm-none-eabi-ar -r tx.a tx_thread_stack_build.o tx_thread_schedule.o tx_thread_system_return.o tx_thread_context_save.o tx_thread_context_restore.o tx_timer_interrupt.o tx_thread_interrupt_control.o -arm-none-eabi-ar -r tx.a tx_thread_interrupt_control.o arm-none-eabi-ar -r tx.a tx_block_allocate.o tx_block_pool_cleanup.o tx_block_pool_create.o tx_block_pool_delete.o tx_block_pool_info_get.o arm-none-eabi-ar -r tx.a tx_block_pool_initialize.o tx_block_pool_performance_info_get.o tx_block_pool_performance_system_info_get.o tx_block_pool_prioritize.o arm-none-eabi-ar -r tx.a tx_block_release.o tx_byte_allocate.o tx_byte_pool_cleanup.o tx_byte_pool_create.o tx_byte_pool_delete.o tx_byte_pool_info_get.o diff --git a/ports/cortex_m0/gnu/example_build/build_threadx_sample.bat b/ports/cortex_m0/gnu/example_build/build_threadx_sample.bat index 96c754d5..e0c7b374 100644 --- a/ports/cortex_m0/gnu/example_build/build_threadx_sample.bat +++ b/ports/cortex_m0/gnu/example_build/build_threadx_sample.bat @@ -1,7 +1,5 @@ -arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb tx_vectors.S +arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb cortexm0_vectors.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb cortexm0_crt0.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb tx_initialize_low_level.S arm-none-eabi-gcc -c -g -mcpu=cortex-m0 -mthumb -I../../../../common/inc -I../inc sample_threadx.c -arm-none-eabi-ld -A cortex-m0 -ereset_handler -T sample_threadx.ld tx_vectors.o cortexm0_crt0.o tx_initialize_low_level.o sample_threadx.o tx.a libgcc.a -o sample_threadx.out -M > sample_threadx.map - - +arm-none-eabi-gcc -g -mcpu=cortex-m0 -mthumb -T sample_threadx.ld -ereset_handler -nostartfiles -o sample_threadx.out -Wl,-Map=sample_threadx.map cortexm0_vectors.o cortexm0_crt0.o tx_initialize_low_level.o sample_threadx.o tx.a diff --git a/ports/cortex_m0/gnu/example_build/cortexm0_crt0.s b/ports/cortex_m0/gnu/example_build/cortexm0_crt0.S index d4cb1636..bb530ac5 100644 --- a/ports/cortex_m0/gnu/example_build/cortexm0_crt0.s +++ b/ports/cortex_m0/gnu/example_build/cortexm0_crt0.S @@ -13,7 +13,6 @@ _start: ldr r1, =__stack_end__ mov sp, r1 - /* Copy initialised sections into RAM if required. */ ldr r0, =__data_load_start__ ldr r1, =__data_start__ @@ -47,7 +46,6 @@ _start: mov r2, #0 bl crt0_memory_set - /* Setup heap - not recommended for Threadx but here for compatibility reasons */ ldr r0, = __heap_start__ ldr r1, = __heap_end__ @@ -57,7 +55,6 @@ _start: add r0, r0, #4 str r1, [r0] - /* constructors in case of using C++ */ ldr r0, =__ctors_start__ ldr r1, =__ctors_end__ @@ -72,13 +69,11 @@ crt0_ctor_loop: b crt0_ctor_loop crt0_ctor_end: - /* Setup call frame for main() */ mov r0, #0 mov lr, r0 mov r12, sp - start: /* Jump to main() */ mov r0, #0 @@ -93,7 +88,6 @@ crt0_exit_loop: /* Startup helper functions. */ - crt0_memory_copy: cmp r0, r1 beq memory_copy_done @@ -109,7 +103,6 @@ memory_copy_loop: memory_copy_done: bx lr - crt0_memory_set: cmp r0, r1 beq memory_set_done @@ -119,7 +112,6 @@ crt0_memory_set: memory_set_done: bx lr - /* Setup attibutes of stack and heap sections so they don't take up room in the elf file */ .section .stack, "wa", %nobits .section .stack_process, "wa", %nobits diff --git a/ports/cortex_m0/gnu/example_build/tx_vectors.s b/ports/cortex_m0/gnu/example_build/cortexm0_vectors.S index 55395cd1..6ae558e4 100644 --- a/ports/cortex_m0/gnu/example_build/tx_vectors.s +++ b/ports/cortex_m0/gnu/example_build/cortexm0_vectors.S @@ -1,5 +1,3 @@ - - .global reset_handler .global __tx_NMIHandler @@ -9,8 +7,6 @@ .global __tx_PendSVHandler .global __tx_SysTickHandler .global __tx_BadHandler - .global __tx_HardfaultHandler - .syntax unified .section .vectors, "ax" @@ -30,7 +26,7 @@ _vectors: .word 0 // Reserved .word 0 // Reserved .word 0 // Reserved - .word __tx_SVCallHandler //_SVC_Handler - used by Threadx scheduler // + .word __tx_SVCallHandler //_SVC_Handler - used by Threadx scheduler // .word __tx_DBGHandler .word 0 // Reserved .word __tx_PendSVHandler @@ -71,32 +67,11 @@ _vectors: .word __tx_BadHandler .word __tx_BadHandler - - - .section .init, "ax" - .thumb_func + .section .init, "ax" + .thumb_func reset_handler: - -// low level hardware config, such as PLL setup goes here - + // low level hardware config, such as PLL setup goes here b _start - .text 32 - .align 4 - .syntax unified - - -__tx_NMIHandler: - b __tx_NMIHandler - -__tx_BadHandler: - b __tx_BadHandler - -__tx_DBGHandler: - b __tx_DBGHandler - -__tx_HardfaultHandler: - b __tx_HardfaultHandler - diff --git a/ports/cortex_m0/gnu/example_build/sample_threadx.ld b/ports/cortex_m0/gnu/example_build/sample_threadx.ld index 28f203fd..c65a1346 100644 --- a/ports/cortex_m0/gnu/example_build/sample_threadx.ld +++ b/ports/cortex_m0/gnu/example_build/sample_threadx.ld @@ -1,206 +1,125 @@ MEMORY { - UNPLACED_SECTIONS (wx) : ORIGIN = 0x100000000, LENGTH = 0 - CM3_System_Control_Space (wx) : ORIGIN = 0xe000e000, LENGTH = 0x00001000 - AHB_Peripherals (wx) : ORIGIN = 0x50000000, LENGTH = 0x00200000 - APB1_Peripherals (wx) : ORIGIN = 0x40080000, LENGTH = 0x00080000 - APB0_Peripherals (wx) : ORIGIN = 0x40000000, LENGTH = 0x00080000 - GPIO (wx) : ORIGIN = 0x2009c000, LENGTH = 0x00004000 - AHBSRAM1 (wx) : ORIGIN = 0x20080000, LENGTH = 0x00004000 - AHBSRAM0 (wx) : ORIGIN = 0x2007c000, LENGTH = 0x00004000 - RAM (wx) : ORIGIN = 0x10000000, LENGTH = 0x00008000 - FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000 + RAM (wx) : ORIGIN = 0x20000000, LENGTH = 0x00800000 + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00400000 } +__STACKSIZE__ = 1024; +__STACKSIZE_PROCESS__ = 0; +__HEAPSIZE__ = 128; SECTIONS { - __CM3_System_Control_Space_segment_start__ = 0xe000e000; - __CM3_System_Control_Space_segment_end__ = 0xe000f000; - __AHB_Peripherals_segment_start__ = 0x50000000; - __AHB_Peripherals_segment_end__ = 0x50200000; - __APB1_Peripherals_segment_start__ = 0x40080000; - __APB1_Peripherals_segment_end__ = 0x40100000; - __APB0_Peripherals_segment_start__ = 0x40000000; - __APB0_Peripherals_segment_end__ = 0x40080000; - __GPIO_segment_start__ = 0x2009c000; - __GPIO_segment_end__ = 0x200a0000; - __AHBSRAM1_segment_start__ = 0x20080000; - __AHBSRAM1_segment_end__ = 0x20084000; - __AHBSRAM0_segment_start__ = 0x2007c000; - __AHBSRAM0_segment_end__ = 0x20080000; - __RAM_segment_start__ = 0x10000000; - __RAM_segment_end__ = 0x10008000; - __FLASH_segment_start__ = 0x00000000; - __FLASH_segment_end__ = 0x00080000; - - __STACKSIZE__ = 1024; - __STACKSIZE_PROCESS__ = 0; - __STACKSIZE_IRQ__ = 0; - __STACKSIZE_FIQ__ = 0; - __STACKSIZE_SVC__ = 0; - __STACKSIZE_ABT__ = 0; - __STACKSIZE_UND__ = 0; - __HEAPSIZE__ = 128; - - __vectors_load_start__ = __FLASH_segment_start__; - .vectors __FLASH_segment_start__ : AT(__FLASH_segment_start__) - { - __vectors_start__ = .; - *(.vectors .vectors.*) - } - __vectors_end__ = __vectors_start__ + SIZEOF(.vectors); - - . = ASSERT(__vectors_end__ >= __FLASH_segment_start__ && __vectors_end__ <= (__FLASH_segment_start__ + 0x00080000) , "error: .vectors is too large to fit in FLASH memory segment"); - - __init_load_start__ = ALIGN(__vectors_end__ , 4); - .init ALIGN(__vectors_end__ , 4) : AT(ALIGN(__vectors_end__ , 4)) - { - __init_start__ = .; - *(.init .init.*) - } - __init_end__ = __init_start__ + SIZEOF(.init); - - . = ASSERT(__init_end__ >= __FLASH_segment_start__ && __init_end__ <= (__FLASH_segment_start__ + 0x00080000) , "error: .init is too large to fit in FLASH memory segment"); - - __text_load_start__ = ALIGN(__init_end__ , 4); - .text ALIGN(__init_end__ , 4) : AT(ALIGN(__init_end__ , 4)) + .vectors : { - __text_start__ = .; - *(.text .text.* .glue_7t .glue_7 .gnu.linkonce.t.* .gcc_except_table) - } - __text_end__ = __text_start__ + SIZEOF(.text); - - . = ASSERT(__text_end__ >= __FLASH_segment_start__ && __text_end__ <= (__FLASH_segment_start__ + 0x00080000) , "error: .text is too large to fit in FLASH memory segment"); - - __dtors_load_start__ = ALIGN(__text_end__ , 4); - .dtors ALIGN(__text_end__ , 4) : AT(ALIGN(__text_end__ , 4)) - { - __dtors_start__ = .; - KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) - } - __dtors_end__ = __dtors_start__ + SIZEOF(.dtors); - - . = ASSERT(__dtors_end__ >= __FLASH_segment_start__ && __dtors_end__ <= (__FLASH_segment_start__ + 0x00080000) , "error: .dtors is too large to fit in FLASH memory segment"); - - __ctors_load_start__ = ALIGN(__dtors_end__ , 4); - .ctors ALIGN(__dtors_end__ , 4) : AT(ALIGN(__dtors_end__ , 4)) - { - __ctors_start__ = .; - KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) - } - __ctors_end__ = __ctors_start__ + SIZEOF(.ctors); - - . = ASSERT(__ctors_end__ >= __FLASH_segment_start__ && __ctors_end__ <= (__FLASH_segment_start__ + 0x00080000) , "error: .ctors is too large to fit in FLASH memory segment"); + KEEP(*(.vectors .vectors.*)) + } > FLASH - __rodata_load_start__ = ALIGN(__ctors_end__ , 4); - .rodata ALIGN(__ctors_end__ , 4) : AT(ALIGN(__ctors_end__ , 4)) - { - __rodata_start__ = .; - *(.rodata .rodata.* .gnu.linkonce.r.*) - } - __rodata_end__ = __rodata_start__ + SIZEOF(.rodata); + .text : + { + *(.text*) - . = ASSERT(__rodata_end__ >= __FLASH_segment_start__ && __rodata_end__ <= (__FLASH_segment_start__ + 0x00080000) , "error: .rodata is too large to fit in FLASH memory segment"); + KEEP(*(.init)) + KEEP(*(.fini)) - __fast_load_start__ = ALIGN(__rodata_end__ , 4); - .fast ALIGN(__RAM_segment_start__ , 4) : AT(ALIGN(__rodata_end__ , 4)) - { - __fast_start__ = .; - *(.fast .fast.*) - } - __fast_end__ = __fast_start__ + SIZEOF(.fast); + /* .ctors */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + __ctors_start__ = ALIGN(4); + *(SORT(.ctors.*)) + *(.ctors) + __ctors_end__ = ALIGN(4); - __fast_load_end__ = __fast_load_start__ + SIZEOF(.fast); + /* .dtors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + __dtors_start__ = ALIGN(4); + *(SORT(.dtors.*)) + *(.dtors) + __dtors_end__ = ALIGN(4); - . = ASSERT((__fast_load_start__ + SIZEOF(.fast)) >= __FLASH_segment_start__ && (__fast_load_start__ + SIZEOF(.fast)) <= (__FLASH_segment_start__ + 0x00080000) , "error: .fast is too large to fit in FLASH memory segment"); + *(.rodata*) - .fast_run ALIGN(__RAM_segment_start__ , 4) (NOLOAD) : - { - __fast_run_start__ = .; - . = MAX(__fast_run_start__ + SIZEOF(.fast), .); - } - __fast_run_end__ = __fast_run_start__ + SIZEOF(.fast_run); + KEEP(*(.eh_frame*)) + } > FLASH - . = ASSERT(__fast_run_end__ >= __RAM_segment_start__ && __fast_run_end__ <= (__RAM_segment_start__ + 0x00008000) , "error: .fast_run is too large to fit in RAM memory segment"); + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH - __data_load_start__ = ALIGN(__fast_load_start__ + SIZEOF(.fast) , 4); - .data ALIGN(__fast_run_end__ , 4) : AT(ALIGN(__fast_load_start__ + SIZEOF(.fast) , 4)) - { - __data_start__ = .; - *(.data .data.* .gnu.linkonce.d.*) - } - __data_end__ = __data_start__ + SIZEOF(.data); + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + __exidx_end = .; - __data_load_end__ = __data_load_start__ + SIZEOF(.data); + __data_load_start__ = ALIGN (4); - __FLASH_segment_used_end__ = ALIGN(__fast_load_start__ + SIZEOF(.fast) , 4) + SIZEOF(.data); + .data : AT (__data_load_start__) + { + __data_start__ = .; - . = ASSERT((__data_load_start__ + SIZEOF(.data)) >= __FLASH_segment_start__ && (__data_load_start__ + SIZEOF(.data)) <= (__FLASH_segment_start__ + 0x00080000) , "error: .data is too large to fit in FLASH memory segment"); + *(vtable) + *(.data*) - .data_run ALIGN(__fast_run_end__ , 4) (NOLOAD) : - { - __data_run_start__ = .; - . = MAX(__data_run_start__ + SIZEOF(.data), .); - } - __data_run_end__ = __data_run_start__ + SIZEOF(.data_run); + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); - . = ASSERT(__data_run_end__ >= __RAM_segment_start__ && __data_run_end__ <= (__RAM_segment_start__ + 0x00008000) , "error: .data_run is too large to fit in RAM memory segment"); + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); - __bss_load_start__ = ALIGN(__data_run_end__ , 4); - .bss ALIGN(__data_run_end__ , 4) (NOLOAD) : AT(ALIGN(__data_run_end__ , 4)) - { - __bss_start__ = .; - *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) - } - __bss_end__ = __bss_start__ + SIZEOF(.bss); + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); - . = ASSERT(__bss_end__ >= __RAM_segment_start__ && __bss_end__ <= (__RAM_segment_start__ + 0x00008000) , "error: .bss is too large to fit in RAM memory segment"); + KEEP(*(.jcr*)) + . = ALIGN(4); + /* All data end */ + + __data_end__ = .; - __non_init_load_start__ = ALIGN(__bss_end__ , 4); - .non_init ALIGN(__bss_end__ , 4) (NOLOAD) : AT(ALIGN(__bss_end__ , 4)) - { - __non_init_start__ = .; - *(.non_init .non_init.*) - } - __non_init_end__ = __non_init_start__ + SIZEOF(.non_init); + } > RAM - . = ASSERT(__non_init_end__ >= __RAM_segment_start__ && __non_init_end__ <= (__RAM_segment_start__ + 0x00008000) , "error: .non_init is too large to fit in RAM memory segment"); + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; - __heap_load_start__ = ALIGN(__non_init_end__ , 4); - .heap ALIGN(__non_init_end__ , 4) (NOLOAD) : AT(ALIGN(__non_init_end__ , 4)) - { - __heap_start__ = .; + } > RAM + + .heap (COPY): + { + __heap_start__ = ALIGN(4); *(.heap) - . = ALIGN(MAX(__heap_start__ + __HEAPSIZE__ , .), 4); - } - __heap_end__ = __heap_start__ + SIZEOF(.heap); + . = ALIGN(. + __HEAPSIZE__, 4); + __heap_end__ = ALIGN(4); + } > RAM - . = ASSERT(__heap_end__ >= __RAM_segment_start__ && __heap_end__ <= (__RAM_segment_start__ + 0x00008000) , "error: .heap is too large to fit in RAM memory segment"); - - __stack_load_start__ = ALIGN(__heap_end__ , 4); - .stack ALIGN(__heap_end__ , 4) (NOLOAD) : AT(ALIGN(__heap_end__ , 4)) + .stack ALIGN(4) (NOLOAD) : { - __stack_start__ = .; + __stack_start__ = ALIGN(4); *(.stack) - . = ALIGN(MAX(__stack_start__ + __STACKSIZE__ , .), 4); - } - __stack_end__ = __stack_start__ + SIZEOF(.stack); - - . = ASSERT(__stack_end__ >= __RAM_segment_start__ && __stack_end__ <= (__RAM_segment_start__ + 0x00008000) , "error: .stack is too large to fit in RAM memory segment"); - - __stack_process_load_start__ = ALIGN(__stack_end__ , 4); - .stack_process ALIGN(__stack_end__ , 4) (NOLOAD) : AT(ALIGN(__stack_end__ , 4)) - { - __stack_process_start__ = .; - *(.stack_process) - . = ALIGN(MAX(__stack_process_start__ + __STACKSIZE_PROCESS__ , .), 4); - } - __stack_process_end__ = __stack_process_start__ + SIZEOF(.stack_process); - - __RAM_segment_used_end__ = ALIGN(__stack_end__ , 4) + SIZEOF(.stack_process); - - . = ASSERT(__stack_process_end__ >= __RAM_segment_start__ && __stack_process_end__ <= (__RAM_segment_start__ + 0x00008000) , "error: .stack_process is too large to fit in RAM memory segment"); + . = ALIGN(. + __STACKSIZE__, 4); + __stack_end__ = ALIGN(4); + } > RAM + __RAM_segment_used_end__ = .; } - |
