From 4b245f8744ae7abc8d77a9b90f273106eee3541f Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Tue, 15 Nov 2011 03:10:04 -0500 Subject: Remove CS3-style initialization. Remove libcs3-related bits from support/ld. Break them out into libmaple proper and Wirish as appropriate: vector table definition and ISR declarations go into libmaple proper, and startup code goes into Wirish. Vector table symbols are included into common.inc from an STM32 family-specific directory under support/ld/stm32. This is a combination of 5 commits. Individual commit messages follow: libcs3_stm32_src: Don't depend on cs3.h. So we can use the existing toolchain. Move ISR decls/vector table into libmaple proper. This allows us to configure the vector table on a per-family basis. - Move support/ld/libcs3_stm32_src/stm32_isrs.S stm32_vector_table.S to libmaple/stm32f1/isrs_performance.S vector_table_performance.S, respectively. The directory libmaple/stm32f1/ is intended to hold all STM32F1-specific code within libmaple. Obviously, there's a lot of work to do before this becomes true. - support/ld/libcs3_stm32_src/Makefile: Don't try to compile stm32_isrs.S and stm32_vector_table.S anymore. - Add libmaple/stm32f1/rules.mk to include these new files in the standard libmaple build. - support/make/target-config.mk: Add LIBMAPLE_MODULE_FAMILY, which selects a directory to use as a family-specific libmaple submodule. - Makefile: Add LIBMAPLE_MODULE_FAMILY to LIBMAPLE_MODULES. Remove support/ld/libcs3_stm32_src and derived object files. From support/ld/libcs3_stm32_src, move start.S and start_c.c into Wirish. Modify wirish/rules.mk accordingly. Delete support/ld/libcs3_stm32_*_density.a. These are no longer necessary, as the relevant objects are included in the standard Wirish build. Remove the GROUP statements from the board linker scripts accordingly. Remove SEARCH_DIR(.) from common.inc; it's no longer necessary. Also fix up some comments that are now out of date. wirish/start_c.c: Don't use CS3-style memory initialization. Switch memory initialization to a simpler style of initializing .data if necessary, then zeroing .bss. Initializing .data is only necessary during Flash builds, since during RAM builds, LOADADDR(.data) == ADDR(.data). This makes libmaple completely incompatible with the CS3 startup sequence. Subsequent commits will clean up the namespace to reflect that fact. Signed-off-by: Marti Bolivar --- Makefile | 1 + libmaple/stm32f1/isrs_performance.S | 235 +++++++++++++++++++++++ libmaple/stm32f1/rules.mk | 23 +++ libmaple/stm32f1/vector_table_performance.S | 90 +++++++++ support/ld/common.inc | 48 ++--- support/ld/libcs3_stm32_high_density.a | Bin 9412 -> 0 bytes support/ld/libcs3_stm32_med_density.a | Bin 9412 -> 0 bytes support/ld/libcs3_stm32_src/Makefile | 35 ---- support/ld/libcs3_stm32_src/start.S | 27 --- support/ld/libcs3_stm32_src/start_c.c | 58 ------ support/ld/libcs3_stm32_src/stm32_isrs.S | 235 ----------------------- support/ld/libcs3_stm32_src/stm32_vector_table.S | 90 --------- support/ld/maple/flash.ld | 5 - support/ld/maple/jtag.ld | 5 - support/ld/maple/ram.ld | 5 - support/ld/maple_RET6/flash.ld | 2 - support/ld/maple_RET6/jtag.ld | 2 - support/ld/maple_RET6/ram.ld | 2 - support/ld/maple_mini/flash.ld | 5 - support/ld/maple_mini/jtag.ld | 5 - support/ld/maple_mini/ram.ld | 5 - support/ld/maple_native/flash.ld | 5 - support/ld/maple_native/jtag.ld | 5 - support/ld/maple_native/ram.ld | 5 - support/make/target-config.mk | 3 +- wirish/rules.mk | 7 +- wirish/start.S | 27 +++ wirish/start_c.c | 65 +++++++ 28 files changed, 464 insertions(+), 531 deletions(-) create mode 100644 libmaple/stm32f1/isrs_performance.S create mode 100644 libmaple/stm32f1/rules.mk create mode 100644 libmaple/stm32f1/vector_table_performance.S delete mode 100644 support/ld/libcs3_stm32_high_density.a delete mode 100644 support/ld/libcs3_stm32_med_density.a delete mode 100644 support/ld/libcs3_stm32_src/Makefile delete mode 100644 support/ld/libcs3_stm32_src/start.S delete mode 100644 support/ld/libcs3_stm32_src/start_c.c delete mode 100644 support/ld/libcs3_stm32_src/stm32_isrs.S delete mode 100644 support/ld/libcs3_stm32_src/stm32_vector_table.S create mode 100644 wirish/start.S create mode 100644 wirish/start_c.c diff --git a/Makefile b/Makefile index 11a3ccc..45b34da 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,7 @@ ifeq ($(LIBMAPLE_MODULES),) else LIBMAPLE_MODULES += $(SRCROOT)/libmaple endif +LIBMAPLE_MODULES += $(LIBMAPLE_MODULE_FAMILY) # family submodule in libmaple LIBMAPLE_MODULES += $(SRCROOT)/wirish # Official libraries: LIBMAPLE_MODULES += $(SRCROOT)/libraries/Servo diff --git a/libmaple/stm32f1/isrs_performance.S b/libmaple/stm32f1/isrs_performance.S new file mode 100644 index 0000000..be102e7 --- /dev/null +++ b/libmaple/stm32f1/isrs_performance.S @@ -0,0 +1,235 @@ +/* STM32 ISR weak declarations */ + + .thumb + +/* Default handler for all non-overridden interrupts and exceptions */ + .globl __default_handler + .type __default_handler, %function + +__default_handler: + b . + + .weak __exc_nmi + .globl __exc_nmi + .set __exc_nmi, __default_handler + .weak __exc_hardfault + .globl __exc_hardfault + .set __exc_hardfault, __default_handler + .weak __exc_memmanage + .globl __exc_memmanage + .set __exc_memmanage, __default_handler + .weak __exc_busfault + .globl __exc_busfault + .set __exc_busfault, __default_handler + .weak __exc_usagefault + .globl __exc_usagefault + .set __exc_usagefault, __default_handler + .weak __stm32reservedexception7 + .globl __stm32reservedexception7 + .set __stm32reservedexception7, __default_handler + .weak __stm32reservedexception8 + .globl __stm32reservedexception8 + .set __stm32reservedexception8, __default_handler + .weak __stm32reservedexception9 + .globl __stm32reservedexception9 + .set __stm32reservedexception9, __default_handler + .weak __stm32reservedexception10 + .globl __stm32reservedexception10 + .set __stm32reservedexception10, __default_handler + .weak __exc_svc + .globl __exc_svc + .set __exc_svc, __default_handler + .weak __exc_debug_monitor + .globl __exc_debug_monitor + .set __exc_debug_monitor, __default_handler + .weak __stm32reservedexception13 + .globl __stm32reservedexception13 + .set __stm32reservedexception13, __default_handler + .weak __exc_pendsv + .globl __exc_pendsv + .set __exc_pendsv, __default_handler + .weak __exc_systick + .globl __exc_systick + .set __exc_systick, __default_handler + .weak __irq_wwdg + .globl __irq_wwdg + .set __irq_wwdg, __default_handler + .weak __irq_pvd + .globl __irq_pvd + .set __irq_pvd, __default_handler + .weak __irq_tamper + .globl __irq_tamper + .set __irq_tamper, __default_handler + .weak __irq_rtc + .globl __irq_rtc + .set __irq_rtc, __default_handler + .weak __irq_flash + .globl __irq_flash + .set __irq_flash, __default_handler + .weak __irq_rcc + .globl __irq_rcc + .set __irq_rcc, __default_handler + .weak __irq_exti0 + .globl __irq_exti0 + .set __irq_exti0, __default_handler + .weak __irq_exti1 + .globl __irq_exti1 + .set __irq_exti1, __default_handler + .weak __irq_exti2 + .globl __irq_exti2 + .set __irq_exti2, __default_handler + .weak __irq_exti3 + .globl __irq_exti3 + .set __irq_exti3, __default_handler + .weak __irq_exti4 + .globl __irq_exti4 + .set __irq_exti4, __default_handler + .weak __irq_dma1_channel1 + .globl __irq_dma1_channel1 + .set __irq_dma1_channel1, __default_handler + .weak __irq_dma1_channel2 + .globl __irq_dma1_channel2 + .set __irq_dma1_channel2, __default_handler + .weak __irq_dma1_channel3 + .globl __irq_dma1_channel3 + .set __irq_dma1_channel3, __default_handler + .weak __irq_dma1_channel4 + .globl __irq_dma1_channel4 + .set __irq_dma1_channel4, __default_handler + .weak __irq_dma1_channel5 + .globl __irq_dma1_channel5 + .set __irq_dma1_channel5, __default_handler + .weak __irq_dma1_channel6 + .globl __irq_dma1_channel6 + .set __irq_dma1_channel6, __default_handler + .weak __irq_dma1_channel7 + .globl __irq_dma1_channel7 + .set __irq_dma1_channel7, __default_handler + .weak __irq_adc + .globl __irq_adc + .set __irq_adc, __default_handler + .weak __irq_usb_hp_can_tx + .globl __irq_usb_hp_can_tx + .set __irq_usb_hp_can_tx, __default_handler + .weak __irq_usb_lp_can_rx0 + .globl __irq_usb_lp_can_rx0 + .set __irq_usb_lp_can_rx0, __default_handler + .weak __irq_can_rx1 + .globl __irq_can_rx1 + .set __irq_can_rx1, __default_handler + .weak __irq_can_sce + .globl __irq_can_sce + .set __irq_can_sce, __default_handler + .weak __irq_exti9_5 + .globl __irq_exti9_5 + .set __irq_exti9_5, __default_handler + .weak __irq_tim1_brk + .globl __irq_tim1_brk + .set __irq_tim1_brk, __default_handler + .weak __irq_tim1_up + .globl __irq_tim1_up + .set __irq_tim1_up, __default_handler + .weak __irq_tim1_trg_com + .globl __irq_tim1_trg_com + .set __irq_tim1_trg_com, __default_handler + .weak __irq_tim1_cc + .globl __irq_tim1_cc + .set __irq_tim1_cc, __default_handler + .weak __irq_tim2 + .globl __irq_tim2 + .set __irq_tim2, __default_handler + .weak __irq_tim3 + .globl __irq_tim3 + .set __irq_tim3, __default_handler + .weak __irq_tim4 + .globl __irq_tim4 + .set __irq_tim4, __default_handler + .weak __irq_i2c1_ev + .globl __irq_i2c1_ev + .set __irq_i2c1_ev, __default_handler + .weak __irq_i2c1_er + .globl __irq_i2c1_er + .set __irq_i2c1_er, __default_handler + .weak __irq_i2c2_ev + .globl __irq_i2c2_ev + .set __irq_i2c2_ev, __default_handler + .weak __irq_i2c2_er + .globl __irq_i2c2_er + .set __irq_i2c2_er, __default_handler + .weak __irq_spi1 + .globl __irq_spi1 + .set __irq_spi1, __default_handler + .weak __irq_spi2 + .globl __irq_spi2 + .set __irq_spi2, __default_handler + .weak __irq_usart1 + .globl __irq_usart1 + .set __irq_usart1, __default_handler + .weak __irq_usart2 + .globl __irq_usart2 + .set __irq_usart2, __default_handler + .weak __irq_usart3 + .globl __irq_usart3 + .set __irq_usart3, __default_handler + .weak __irq_exti15_10 + .globl __irq_exti15_10 + .set __irq_exti15_10, __default_handler + .weak __irq_rtcalarm + .globl __irq_rtcalarm + .set __irq_rtcalarm, __default_handler + .weak __irq_usbwakeup + .globl __irq_usbwakeup + .set __irq_usbwakeup, __default_handler +#if defined (STM32_HIGH_DENSITY) + .weak __irq_tim8_brk + .globl __irq_tim8_brk + .set __irq_tim8_brk, __default_handler + .weak __irq_tim8_up + .globl __irq_tim8_up + .set __irq_tim8_up, __default_handler + .weak __irq_tim8_trg_com + .globl __irq_tim8_trg_com + .set __irq_tim8_trg_com, __default_handler + .weak __irq_tim8_cc + .globl __irq_tim8_cc + .set __irq_tim8_cc, __default_handler + .weak __irq_adc3 + .globl __irq_adc3 + .set __irq_adc3, __default_handler + .weak __irq_fsmc + .globl __irq_fsmc + .set __irq_fsmc, __default_handler + .weak __irq_sdio + .globl __irq_sdio + .set __irq_sdio, __default_handler + .weak __irq_tim5 + .globl __irq_tim5 + .set __irq_tim5, __default_handler + .weak __irq_spi3 + .globl __irq_spi3 + .set __irq_spi3, __default_handler + .weak __irq_uart4 + .globl __irq_uart4 + .set __irq_uart4, __default_handler + .weak __irq_uart5 + .globl __irq_uart5 + .set __irq_uart5, __default_handler + .weak __irq_tim6 + .globl __irq_tim6 + .set __irq_tim6, __default_handler + .weak __irq_tim7 + .globl __irq_tim7 + .set __irq_tim7, __default_handler + .weak __irq_dma2_channel1 + .globl __irq_dma2_channel1 + .set __irq_dma2_channel1, __default_handler + .weak __irq_dma2_channel2 + .globl __irq_dma2_channel2 + .set __irq_dma2_channel2, __default_handler + .weak __irq_dma2_channel3 + .globl __irq_dma2_channel3 + .set __irq_dma2_channel3, __default_handler + .weak __irq_dma2_channel4_5 + .globl __irq_dma2_channel4_5 + .set __irq_dma2_channel4_5, __default_handler +#endif /* STM32_HIGH_DENSITY */ diff --git a/libmaple/stm32f1/rules.mk b/libmaple/stm32f1/rules.mk new file mode 100644 index 0000000..5cadefd --- /dev/null +++ b/libmaple/stm32f1/rules.mk @@ -0,0 +1,23 @@ +# Standard things +sp := $(sp).x +dirstack_$(sp) := $(d) +d := $(dir) +BUILDDIRS += $(BUILD_PATH)/$(d) + +# Local rules and targets +sSRCS_$(d) := isrs_performance.S \ + vector_table_performance.S + +sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) + +OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) +DEPS_$(d) := $(OBJS_$(d):%.o=%.d) + +$(OBJS_$(d)): TGT_ASFLAGS := + +TGT_BIN += $(OBJS_$(d)) + +# Standard things +-include $(DEPS_$(d)) +d := $(dirstack_$(sp)) +sp := $(basename $(sp)) diff --git a/libmaple/stm32f1/vector_table_performance.S b/libmaple/stm32f1/vector_table_performance.S new file mode 100644 index 0000000..7067d95 --- /dev/null +++ b/libmaple/stm32f1/vector_table_performance.S @@ -0,0 +1,90 @@ +/* STM32 vector table */ + + .section ".stm32.interrupt_vector" + + .globl __cs3_stm32_vector_table + .type __cs3_stm32_vector_table, %object + +__cs3_stm32_vector_table: +/* CM3 core interrupts */ + .long __cs3_stack + .long __cs3_reset + .long __exc_nmi + .long __exc_hardfault + .long __exc_memmanage + .long __exc_busfault + .long __exc_usagefault + .long __stm32reservedexception7 + .long __stm32reservedexception8 + .long __stm32reservedexception9 + .long __stm32reservedexception10 + .long __exc_svc + .long __exc_debug_monitor + .long __stm32reservedexception13 + .long __exc_pendsv + .long __exc_systick +/* Peripheral interrupts */ + .long __irq_wwdg + .long __irq_pvd + .long __irq_tamper + .long __irq_rtc + .long __irq_flash + .long __irq_rcc + .long __irq_exti0 + .long __irq_exti1 + .long __irq_exti2 + .long __irq_exti3 + .long __irq_exti4 + .long __irq_dma1_channel1 + .long __irq_dma1_channel2 + .long __irq_dma1_channel3 + .long __irq_dma1_channel4 + .long __irq_dma1_channel5 + .long __irq_dma1_channel6 + .long __irq_dma1_channel7 + .long __irq_adc + .long __irq_usb_hp_can_tx + .long __irq_usb_lp_can_rx0 + .long __irq_can_rx1 + .long __irq_can_sce + .long __irq_exti9_5 + .long __irq_tim1_brk + .long __irq_tim1_up + .long __irq_tim1_trg_com + .long __irq_tim1_cc + .long __irq_tim2 + .long __irq_tim3 + .long __irq_tim4 + .long __irq_i2c1_ev + .long __irq_i2c1_er + .long __irq_i2c2_ev + .long __irq_i2c2_er + .long __irq_spi1 + .long __irq_spi2 + .long __irq_usart1 + .long __irq_usart2 + .long __irq_usart3 + .long __irq_exti15_10 + .long __irq_rtcalarm + .long __irq_usbwakeup +#if defined (STM32_HIGH_DENSITY) + .long __irq_tim8_brk + .long __irq_tim8_up + .long __irq_tim8_trg_com + .long __irq_tim8_cc + .long __irq_adc3 + .long __irq_fsmc + .long __irq_sdio + .long __irq_tim5 + .long __irq_spi3 + .long __irq_uart4 + .long __irq_uart5 + .long __irq_tim6 + .long __irq_tim7 + .long __irq_dma2_channel1 + .long __irq_dma2_channel2 + .long __irq_dma2_channel3 + .long __irq_dma2_channel4_5 +#endif /* STM32_HIGH_DENSITY */ + + .size __cs3_stm32_vector_table, . - __cs3_stm32_vector_table diff --git a/support/ld/common.inc b/support/ld/common.inc index c6fa13a..0d1f4ed 100644 --- a/support/ld/common.inc +++ b/support/ld/common.inc @@ -6,7 +6,6 @@ OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") ENTRY(_start) -SEARCH_DIR(.) /* * Link against libgcc, libc, and libm @@ -22,10 +21,10 @@ GROUP(libgcc.a libc.a libm.a) */ INCLUDE vector_symbols.inc -/* STM32 vector table. See stm32_vector_table.S */ +/* STM32 vector table. */ EXTERN(__cs3_stm32_vector_table) -/* libcs3 C start function. See cs3.h */ +/* libcs3 C start function. */ EXTERN(__cs3_start_c) /* main entry point */ @@ -33,9 +32,9 @@ EXTERN(main) /* Initial stack pointer value. */ EXTERN(__cs3_stack) -PROVIDE(__cs3_stack = __cs3_region_start_ram + LENGTH(ram)); +PROVIDE(__cs3_stack = ORIGIN(ram) + LENGTH(ram)); -/* Reset vector and chip reset entry point. See start.S */ +/* Reset vector and chip reset entry point */ EXTERN(_start) PROVIDE(__cs3_reset = _start); @@ -48,7 +47,7 @@ SECTIONS /* TODO pull out rodata and stick into separate sections */ .text : { - __text_start = .; + _text = .; /* * STM32 vector table. Leave this here. Yes, really. */ @@ -100,17 +99,6 @@ SECTIONS KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*crtend.o(.dtors)) - - /* - * struct __cs3_region used during __cs3_start_c - */ - . = ALIGN(4); - __cs3_regions = .; - LONG (0) /* flags */ - LONG (__cs3_region_init_ram) /* initial contents */ - LONG (__cs3_region_start_ram) /* start address */ - LONG (__cs3_region_init_size_ram) /* size of initial data */ - LONG (__cs3_region_zero_size_ram) /* additional size to be zeroed */ } > REGION_TEXT /* @@ -119,6 +107,11 @@ SECTIONS .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) + + /* ROM image configuration; for C startup */ + . = ALIGN(4); + _lm_rom_img_cfgp = .; + LONG(LOADADDR(.data)); } > REGION_RODATA /* @@ -153,7 +146,8 @@ SECTIONS */ .data : { - __cs3_region_start_ram = DEFINED(_FLASH_BUILD) ? . : __text_start; + . = ALIGN(8); + _data = .; *(.got.plt) *(.got) *(.data .data.* .gnu.linkonce.d.*) @@ -178,25 +172,15 @@ SECTIONS */ .bss : { + . = ALIGN(8); + _bss = .; *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) . = ALIGN (8); - _end = .; + _ebss = .; + _end = _ebss; } > REGION_BSS AT> REGION_TEXT - /* - * Constants needed for the pieces of CS3 we use during - * board startup; see libcs3_stm32_src/. - */ - __cs3_region_init_ram = (DEFINED(_FLASH_BUILD) ? - LOADADDR(.data) : - LOADADDR(.text)); - __cs3_region_init_size_ram = (DEFINED(_FLASH_BUILD) ? - _edata - ADDR(.data) : - _edata - ADDR(.text)); - __cs3_region_zero_size_ram = _end - _edata; - __cs3_region_num = 1; - /* * Debugging sections */ diff --git a/support/ld/libcs3_stm32_high_density.a b/support/ld/libcs3_stm32_high_density.a deleted file mode 100644 index b6650ca..0000000 Binary files a/support/ld/libcs3_stm32_high_density.a and /dev/null differ diff --git a/support/ld/libcs3_stm32_med_density.a b/support/ld/libcs3_stm32_med_density.a deleted file mode 100644 index e4660e3..0000000 Binary files a/support/ld/libcs3_stm32_med_density.a and /dev/null differ diff --git a/support/ld/libcs3_stm32_src/Makefile b/support/ld/libcs3_stm32_src/Makefile deleted file mode 100644 index 834cdad..0000000 --- a/support/ld/libcs3_stm32_src/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# setup environment - -TARGET_ARCH = -mcpu=cortex-m3 -mthumb - -CC = arm-none-eabi-gcc -CFLAGS = - -AS = $(CC) -x assembler-with-cpp -c $(TARGET_ARCH) -ASFLAGS = - -AR = arm-none-eabi-ar -ARFLAGS = cr - -LIB_OBJS = stm32_vector_table.o stm32_isrs.o start.o start_c.o - -help: - @echo "Targets:" - @echo "\t medium-density: Target medium density chips (e.g. Maple)" - @echo "\t high-density: Target high density chips (e.g. Maple-native)" - -.PHONY: help medium high - -medium-density: $(LIB_OBJS) - $(AR) $(ARFLAGS) libcs3_stm32_med_density.a $(LIB_OBJS) - rm -f $(LIB_OBJS) - -high-density: CFLAGS := -DSTM32_HIGH_DENSITY -high-density: $(LIB_OBJS) - $(AR) $(ARFLAGS) libcs3_stm32_high_density.a $(LIB_OBJS) - rm -f $(LIB_OBJS) - -# clean -.PHONY: clean -clean: - -rm -f $(LIB_OBJS) *.a diff --git a/support/ld/libcs3_stm32_src/start.S b/support/ld/libcs3_stm32_src/start.S deleted file mode 100644 index 4d1d405..0000000 --- a/support/ld/libcs3_stm32_src/start.S +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - */ - - .text - .code 16 - .thumb_func - - .globl _start - .type _start, %function -_start: - .fnstart - ldr r1,=__cs3_stack - mov sp,r1 - ldr r1,=__cs3_start_c - bx r1 - .pool - .cantunwind - .fnend diff --git a/support/ld/libcs3_stm32_src/start_c.c b/support/ld/libcs3_stm32_src/start_c.c deleted file mode 100644 index 2ab0212..0000000 --- a/support/ld/libcs3_stm32_src/start_c.c +++ /dev/null @@ -1,58 +0,0 @@ -/* CS3 start_c routine. - * - * Copyright (c) 2006, 2007 CodeSourcery Inc - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - */ - -#include "cs3.h" - -extern void __libc_init_array (void); - -extern int main (int, char **, char **); - -extern void exit (int) __attribute__ ((noreturn, weak)); - -void __attribute ((noreturn)) -__cs3_start_c (void) -{ - unsigned regions = __cs3_region_num; - const struct __cs3_region *rptr = __cs3_regions; - int exit_code; - - /* Initialize memory */ - for (regions = __cs3_region_num, rptr = __cs3_regions; regions--; rptr++) - { - long long *src = (long long *)rptr->init; - long long *dst = (long long *)rptr->data; - unsigned limit = rptr->init_size; - unsigned count; - - if (src != dst) - for (count = 0; count != limit; count += sizeof (long long)) - *dst++ = *src++; - else - dst = (long long *)((char *)dst + limit); - limit = rptr->zero_size; - for (count = 0; count != limit; count += sizeof (long long)) - *dst++ = 0; - } - - /* Run initializers. */ - __libc_init_array (); - - exit_code = main (0, NULL, NULL); - if (exit) - exit (exit_code); - /* If exit is NULL, make sure we don't return. */ - for (;;) - continue; -} diff --git a/support/ld/libcs3_stm32_src/stm32_isrs.S b/support/ld/libcs3_stm32_src/stm32_isrs.S deleted file mode 100644 index be102e7..0000000 --- a/support/ld/libcs3_stm32_src/stm32_isrs.S +++ /dev/null @@ -1,235 +0,0 @@ -/* STM32 ISR weak declarations */ - - .thumb - -/* Default handler for all non-overridden interrupts and exceptions */ - .globl __default_handler - .type __default_handler, %function - -__default_handler: - b . - - .weak __exc_nmi - .globl __exc_nmi - .set __exc_nmi, __default_handler - .weak __exc_hardfault - .globl __exc_hardfault - .set __exc_hardfault, __default_handler - .weak __exc_memmanage - .globl __exc_memmanage - .set __exc_memmanage, __default_handler - .weak __exc_busfault - .globl __exc_busfault - .set __exc_busfault, __default_handler - .weak __exc_usagefault - .globl __exc_usagefault - .set __exc_usagefault, __default_handler - .weak __stm32reservedexception7 - .globl __stm32reservedexception7 - .set __stm32reservedexception7, __default_handler - .weak __stm32reservedexception8 - .globl __stm32reservedexception8 - .set __stm32reservedexception8, __default_handler - .weak __stm32reservedexception9 - .globl __stm32reservedexception9 - .set __stm32reservedexception9, __default_handler - .weak __stm32reservedexception10 - .globl __stm32reservedexception10 - .set __stm32reservedexception10, __default_handler - .weak __exc_svc - .globl __exc_svc - .set __exc_svc, __default_handler - .weak __exc_debug_monitor - .globl __exc_debug_monitor - .set __exc_debug_monitor, __default_handler - .weak __stm32reservedexception13 - .globl __stm32reservedexception13 - .set __stm32reservedexception13, __default_handler - .weak __exc_pendsv - .globl __exc_pendsv - .set __exc_pendsv, __default_handler - .weak __exc_systick - .globl __exc_systick - .set __exc_systick, __default_handler - .weak __irq_wwdg - .globl __irq_wwdg - .set __irq_wwdg, __default_handler - .weak __irq_pvd - .globl __irq_pvd - .set __irq_pvd, __default_handler - .weak __irq_tamper - .globl __irq_tamper - .set __irq_tamper, __default_handler - .weak __irq_rtc - .globl __irq_rtc - .set __irq_rtc, __default_handler - .weak __irq_flash - .globl __irq_flash - .set __irq_flash, __default_handler - .weak __irq_rcc - .globl __irq_rcc - .set __irq_rcc, __default_handler - .weak __irq_exti0 - .globl __irq_exti0 - .set __irq_exti0, __default_handler - .weak __irq_exti1 - .globl __irq_exti1 - .set __irq_exti1, __default_handler - .weak __irq_exti2 - .globl __irq_exti2 - .set __irq_exti2, __default_handler - .weak __irq_exti3 - .globl __irq_exti3 - .set __irq_exti3, __default_handler - .weak __irq_exti4 - .globl __irq_exti4 - .set __irq_exti4, __default_handler - .weak __irq_dma1_channel1 - .globl __irq_dma1_channel1 - .set __irq_dma1_channel1, __default_handler - .weak __irq_dma1_channel2 - .globl __irq_dma1_channel2 - .set __irq_dma1_channel2, __default_handler - .weak __irq_dma1_channel3 - .globl __irq_dma1_channel3 - .set __irq_dma1_channel3, __default_handler - .weak __irq_dma1_channel4 - .globl __irq_dma1_channel4 - .set __irq_dma1_channel4, __default_handler - .weak __irq_dma1_channel5 - .globl __irq_dma1_channel5 - .set __irq_dma1_channel5, __default_handler - .weak __irq_dma1_channel6 - .globl __irq_dma1_channel6 - .set __irq_dma1_channel6, __default_handler - .weak __irq_dma1_channel7 - .globl __irq_dma1_channel7 - .set __irq_dma1_channel7, __default_handler - .weak __irq_adc - .globl __irq_adc - .set __irq_adc, __default_handler - .weak __irq_usb_hp_can_tx - .globl __irq_usb_hp_can_tx - .set __irq_usb_hp_can_tx, __default_handler - .weak __irq_usb_lp_can_rx0 - .globl __irq_usb_lp_can_rx0 - .set __irq_usb_lp_can_rx0, __default_handler - .weak __irq_can_rx1 - .globl __irq_can_rx1 - .set __irq_can_rx1, __default_handler - .weak __irq_can_sce - .globl __irq_can_sce - .set __irq_can_sce, __default_handler - .weak __irq_exti9_5 - .globl __irq_exti9_5 - .set __irq_exti9_5, __default_handler - .weak __irq_tim1_brk - .globl __irq_tim1_brk - .set __irq_tim1_brk, __default_handler - .weak __irq_tim1_up - .globl __irq_tim1_up - .set __irq_tim1_up, __default_handler - .weak __irq_tim1_trg_com - .globl __irq_tim1_trg_com - .set __irq_tim1_trg_com, __default_handler - .weak __irq_tim1_cc - .globl __irq_tim1_cc - .set __irq_tim1_cc, __default_handler - .weak __irq_tim2 - .globl __irq_tim2 - .set __irq_tim2, __default_handler - .weak __irq_tim3 - .globl __irq_tim3 - .set __irq_tim3, __default_handler - .weak __irq_tim4 - .globl __irq_tim4 - .set __irq_tim4, __default_handler - .weak __irq_i2c1_ev - .globl __irq_i2c1_ev - .set __irq_i2c1_ev, __default_handler - .weak __irq_i2c1_er - .globl __irq_i2c1_er - .set __irq_i2c1_er, __default_handler - .weak __irq_i2c2_ev - .globl __irq_i2c2_ev - .set __irq_i2c2_ev, __default_handler - .weak __irq_i2c2_er - .globl __irq_i2c2_er - .set __irq_i2c2_er, __default_handler - .weak __irq_spi1 - .globl __irq_spi1 - .set __irq_spi1, __default_handler - .weak __irq_spi2 - .globl __irq_spi2 - .set __irq_spi2, __default_handler - .weak __irq_usart1 - .globl __irq_usart1 - .set __irq_usart1, __default_handler - .weak __irq_usart2 - .globl __irq_usart2 - .set __irq_usart2, __default_handler - .weak __irq_usart3 - .globl __irq_usart3 - .set __irq_usart3, __default_handler - .weak __irq_exti15_10 - .globl __irq_exti15_10 - .set __irq_exti15_10, __default_handler - .weak __irq_rtcalarm - .globl __irq_rtcalarm - .set __irq_rtcalarm, __default_handler - .weak __irq_usbwakeup - .globl __irq_usbwakeup - .set __irq_usbwakeup, __default_handler -#if defined (STM32_HIGH_DENSITY) - .weak __irq_tim8_brk - .globl __irq_tim8_brk - .set __irq_tim8_brk, __default_handler - .weak __irq_tim8_up - .globl __irq_tim8_up - .set __irq_tim8_up, __default_handler - .weak __irq_tim8_trg_com - .globl __irq_tim8_trg_com - .set __irq_tim8_trg_com, __default_handler - .weak __irq_tim8_cc - .globl __irq_tim8_cc - .set __irq_tim8_cc, __default_handler - .weak __irq_adc3 - .globl __irq_adc3 - .set __irq_adc3, __default_handler - .weak __irq_fsmc - .globl __irq_fsmc - .set __irq_fsmc, __default_handler - .weak __irq_sdio - .globl __irq_sdio - .set __irq_sdio, __default_handler - .weak __irq_tim5 - .globl __irq_tim5 - .set __irq_tim5, __default_handler - .weak __irq_spi3 - .globl __irq_spi3 - .set __irq_spi3, __default_handler - .weak __irq_uart4 - .globl __irq_uart4 - .set __irq_uart4, __default_handler - .weak __irq_uart5 - .globl __irq_uart5 - .set __irq_uart5, __default_handler - .weak __irq_tim6 - .globl __irq_tim6 - .set __irq_tim6, __default_handler - .weak __irq_tim7 - .globl __irq_tim7 - .set __irq_tim7, __default_handler - .weak __irq_dma2_channel1 - .globl __irq_dma2_channel1 - .set __irq_dma2_channel1, __default_handler - .weak __irq_dma2_channel2 - .globl __irq_dma2_channel2 - .set __irq_dma2_channel2, __default_handler - .weak __irq_dma2_channel3 - .globl __irq_dma2_channel3 - .set __irq_dma2_channel3, __default_handler - .weak __irq_dma2_channel4_5 - .globl __irq_dma2_channel4_5 - .set __irq_dma2_channel4_5, __default_handler -#endif /* STM32_HIGH_DENSITY */ diff --git a/support/ld/libcs3_stm32_src/stm32_vector_table.S b/support/ld/libcs3_stm32_src/stm32_vector_table.S deleted file mode 100644 index 7067d95..0000000 --- a/support/ld/libcs3_stm32_src/stm32_vector_table.S +++ /dev/null @@ -1,90 +0,0 @@ -/* STM32 vector table */ - - .section ".stm32.interrupt_vector" - - .globl __cs3_stm32_vector_table - .type __cs3_stm32_vector_table, %object - -__cs3_stm32_vector_table: -/* CM3 core interrupts */ - .long __cs3_stack - .long __cs3_reset - .long __exc_nmi - .long __exc_hardfault - .long __exc_memmanage - .long __exc_busfault - .long __exc_usagefault - .long __stm32reservedexception7 - .long __stm32reservedexception8 - .long __stm32reservedexception9 - .long __stm32reservedexception10 - .long __exc_svc - .long __exc_debug_monitor - .long __stm32reservedexception13 - .long __exc_pendsv - .long __exc_systick -/* Peripheral interrupts */ - .long __irq_wwdg - .long __irq_pvd - .long __irq_tamper - .long __irq_rtc - .long __irq_flash - .long __irq_rcc - .long __irq_exti0 - .long __irq_exti1 - .long __irq_exti2 - .long __irq_exti3 - .long __irq_exti4 - .long __irq_dma1_channel1 - .long __irq_dma1_channel2 - .long __irq_dma1_channel3 - .long __irq_dma1_channel4 - .long __irq_dma1_channel5 - .long __irq_dma1_channel6 - .long __irq_dma1_channel7 - .long __irq_adc - .long __irq_usb_hp_can_tx - .long __irq_usb_lp_can_rx0 - .long __irq_can_rx1 - .long __irq_can_sce - .long __irq_exti9_5 - .long __irq_tim1_brk - .long __irq_tim1_up - .long __irq_tim1_trg_com - .long __irq_tim1_cc - .long __irq_tim2 - .long __irq_tim3 - .long __irq_tim4 - .long __irq_i2c1_ev - .long __irq_i2c1_er - .long __irq_i2c2_ev - .long __irq_i2c2_er - .long __irq_spi1 - .long __irq_spi2 - .long __irq_usart1 - .long __irq_usart2 - .long __irq_usart3 - .long __irq_exti15_10 - .long __irq_rtcalarm - .long __irq_usbwakeup -#if defined (STM32_HIGH_DENSITY) - .long __irq_tim8_brk - .long __irq_tim8_up - .long __irq_tim8_trg_com - .long __irq_tim8_cc - .long __irq_adc3 - .long __irq_fsmc - .long __irq_sdio - .long __irq_tim5 - .long __irq_spi3 - .long __irq_uart4 - .long __irq_uart5 - .long __irq_tim6 - .long __irq_tim7 - .long __irq_dma2_channel1 - .long __irq_dma2_channel2 - .long __irq_dma2_channel3 - .long __irq_dma2_channel4_5 -#endif /* STM32_HIGH_DENSITY */ - - .size __cs3_stm32_vector_table, . - __cs3_stm32_vector_table diff --git a/support/ld/maple/flash.ld b/support/ld/maple/flash.ld index 8a179f7..190c187 100644 --- a/support/ld/maple/flash.ld +++ b/support/ld/maple/flash.ld @@ -11,11 +11,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K } -/* - * Use medium density device vector table - */ -GROUP(libcs3_stm32_med_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple/jtag.ld b/support/ld/maple/jtag.ld index 365068f..c090988 100644 --- a/support/ld/maple/jtag.ld +++ b/support/ld/maple/jtag.ld @@ -12,11 +12,6 @@ MEMORY rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K } -/* - * Use medium density device vector table - */ -GROUP(libcs3_stm32_med_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple/ram.ld b/support/ld/maple/ram.ld index 6f237c3..a5ef621 100644 --- a/support/ld/maple/ram.ld +++ b/support/ld/maple/ram.ld @@ -11,11 +11,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K } -/* - * Use medium density device vector table - */ -GROUP(libcs3_stm32_med_density.a) - REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_RET6/flash.ld b/support/ld/maple_RET6/flash.ld index 4cf9c4b..8b529f8 100644 --- a/support/ld/maple_RET6/flash.ld +++ b/support/ld/maple_RET6/flash.ld @@ -9,8 +9,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K } -GROUP(libcs3_stm32_high_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_RET6/jtag.ld b/support/ld/maple_RET6/jtag.ld index 6055dfb..4ac9d76 100644 --- a/support/ld/maple_RET6/jtag.ld +++ b/support/ld/maple_RET6/jtag.ld @@ -9,8 +9,6 @@ MEMORY rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K } -GROUP(libcs3_stm32_high_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_RET6/ram.ld b/support/ld/maple_RET6/ram.ld index a4c273b..65c3a2c 100644 --- a/support/ld/maple_RET6/ram.ld +++ b/support/ld/maple_RET6/ram.ld @@ -9,8 +9,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K } -GROUP(libcs3_stm32_high_density.a) - REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_mini/flash.ld b/support/ld/maple_mini/flash.ld index ab03207..52d01dc 100644 --- a/support/ld/maple_mini/flash.ld +++ b/support/ld/maple_mini/flash.ld @@ -11,11 +11,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 108K } -/* - * Use medium density device vector table - */ -GROUP(libcs3_stm32_med_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_mini/jtag.ld b/support/ld/maple_mini/jtag.ld index 2f9cf31..28e204f 100644 --- a/support/ld/maple_mini/jtag.ld +++ b/support/ld/maple_mini/jtag.ld @@ -12,11 +12,6 @@ MEMORY rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K } -/* - * Use medium density device vector table - */ -GROUP(libcs3_stm32_med_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_mini/ram.ld b/support/ld/maple_mini/ram.ld index 0ba0252..5b0111b 100644 --- a/support/ld/maple_mini/ram.ld +++ b/support/ld/maple_mini/ram.ld @@ -11,11 +11,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K } -/* - * Use medium density device vector table - */ -GROUP(libcs3_stm32_med_density.a) - REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_native/flash.ld b/support/ld/maple_native/flash.ld index b6e10f8..aac5325 100644 --- a/support/ld/maple_native/flash.ld +++ b/support/ld/maple_native/flash.ld @@ -8,11 +8,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 492K } -/* - * Use high density device vector table - */ -GROUP(libcs3_stm32_high_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_native/jtag.ld b/support/ld/maple_native/jtag.ld index 9af2a11..412348e 100644 --- a/support/ld/maple_native/jtag.ld +++ b/support/ld/maple_native/jtag.ld @@ -9,11 +9,6 @@ MEMORY rom (rx) : ORIGIN = 0x08000000, LENGTH = 512K } -/* - * Use high density device vector table - */ -GROUP(libcs3_stm32_high_density.a) - REGION_ALIAS("REGION_TEXT", rom); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/ld/maple_native/ram.ld b/support/ld/maple_native/ram.ld index 7264316..eeec761 100644 --- a/support/ld/maple_native/ram.ld +++ b/support/ld/maple_native/ram.ld @@ -8,11 +8,6 @@ MEMORY rom (rx) : ORIGIN = 0x08005000, LENGTH = 0K } -/* - * Use high density device vector table - */ -GROUP(libcs3_stm32_high_density.a) - REGION_ALIAS("REGION_TEXT", ram); REGION_ALIAS("REGION_DATA", ram); REGION_ALIAS("REGION_BSS", ram); diff --git a/support/make/target-config.mk b/support/make/target-config.mk index f935cad..592e808 100644 --- a/support/make/target-config.mk +++ b/support/make/target-config.mk @@ -52,11 +52,12 @@ endif # STM32 family-specific configuration values. -# NB: this only works for STM32F1 performance line chips, but those +# NB: these only work for STM32F1 performance line chips, but those # are the only ones we support at this time. If you add support for # STM32F1 connectivity line MCUs or other STM32 families, this section # will need to change. LD_FAMILY_PATH := $(LDDIR)/stm32/f1/performance +LIBMAPLE_MODULE_FAMILY := $(LIBMAPLE_PATH)/stm32f1 # Memory target-specific configuration values diff --git a/wirish/rules.mk b/wirish/rules.mk index 6aa0904..1bf6245 100644 --- a/wirish/rules.mk +++ b/wirish/rules.mk @@ -12,8 +12,9 @@ WIRISH_INCLUDES := -I$(d) -I$(d)/comm -I$(d)/boards CFLAGS_$(d) := $(WIRISH_INCLUDES) $(LIBMAPLE_INCLUDES) # Local rules and targets -cSRCS_$(d) := +sSRCS_$(d) := start.S +cSRCS_$(d) := start_c.c cppSRCS_$(d) := wirish_math.cpp \ Print.cpp \ boards.cpp \ @@ -34,10 +35,12 @@ cppSRCS_$(d) := wirish_math.cpp \ ext_interrupts.cpp \ wirish_digital.cpp +sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) cppFILES_$(d) := $(cppSRCS_$(d):%=$(d)/%) -OBJS_$(d) := $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \ +OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ + $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) \ $(cppFILES_$(d):%.cpp=$(BUILD_PATH)/%.o) DEPS_$(d) := $(OBJS_$(d):%.o=%.d) diff --git a/wirish/start.S b/wirish/start.S new file mode 100644 index 0000000..4d1d405 --- /dev/null +++ b/wirish/start.S @@ -0,0 +1,27 @@ +/* + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + + .text + .code 16 + .thumb_func + + .globl _start + .type _start, %function +_start: + .fnstart + ldr r1,=__cs3_stack + mov sp,r1 + ldr r1,=__cs3_start_c + bx r1 + .pool + .cantunwind + .fnend diff --git a/wirish/start_c.c b/wirish/start_c.c new file mode 100644 index 0000000..cb96fc5 --- /dev/null +++ b/wirish/start_c.c @@ -0,0 +1,65 @@ +/* CS3 start_c routine. + * + * Copyright (c) 2006, 2007 CodeSourcery Inc + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include + +extern void __libc_init_array (void); + +extern int main (int, char **, char **); + +extern void exit (int) __attribute__ ((noreturn, weak)); + +extern char _data, _edata; +extern char _bss, _ebss; + +struct rom_img_cfg { + long long *img_start; +}; + +extern char _lm_rom_img_cfgp; + +void __attribute__ ((noreturn)) +__cs3_start_c (void) +{ + struct rom_img_cfg *img_cfg = (struct rom_img_cfg*)&_lm_rom_img_cfgp; + long long *src; + long long *dst; + int exit_code; + + /* Initialize .data, if necessary. */ + src = img_cfg->img_start; + dst = (long long*)&_data; + if (src != dst) { + while (dst < (long long*)&_edata) { + *dst++ = *src++; + } + } + + /* Zero .bss. */ + dst = (long long*)&_bss; + while (dst < (long long*)&_ebss) { + *dst++ = 0; + } + + /* Run initializers. */ + __libc_init_array (); + + exit_code = main (0, NULL, NULL); + if (exit) + exit (exit_code); + /* If exit is NULL, make sure we don't return. */ + for (;;) + continue; +} -- cgit v1.2.3