diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 8cbb010..d1bce9b 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -5,6 +5,7 @@ "includePath": [ "${workspaceFolder}/**", "${workspaceFolder}/source/**", + "${workspaceFolder}/source/soft", "D:/GNU Arm Embedded Toolchain/10 2021.10/arm-none-eabi/include" ], "defines": [ diff --git a/.vscode/settings.json b/.vscode/settings.json index 5aa2e51..c46bc34 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,8 @@ "signal.h": "c", "dev_flash.h": "c", "opt.h": "c", - "if_can.h": "c" + "if_can.h": "c", + "board.h": "c", + "prot_uc.h": "c" } } \ No newline at end of file diff --git a/Makeapp b/Makeapp new file mode 100644 index 0000000..7ec9c13 --- /dev/null +++ b/Makeapp @@ -0,0 +1,290 @@ +########################################################################################################################## +# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Tue Oct 31 22:08:45 CST 2023] +########################################################################################################################## + +# ------------------------------------------------ +# Generic Makefile (based on gcc) +# +# ChangeLog : +# 2017-02-10 - Several enhancements + project update mode +# 2015-07-22 - first version +# ------------------------------------------------ + +###################################### +# target +###################################### +TARGET = checker_slave_app + + +# this file name +SELF_NAME = Makeapp + +###################################### +# building variables +###################################### +# debug build? +DEBUG = 0 +# optimization +# OPT = -Og +OPT = -Og + + +####################################### +# paths +####################################### +# Build path +BUILD_DIR = build/app + +###################################### +# source +###################################### +# C sources +C_SOURCES = \ +source/main/main.c \ +source/core/core_cm3.c \ +source/core/system_stm32f10x.c \ +source/stm32lib/src/misc.c \ +source/stm32lib/src/stm32f10x_adc.c \ +source/stm32lib/src/stm32f10x_bkp.c \ +source/stm32lib/src/stm32f10x_can.c \ +source/stm32lib/src/stm32f10x_cec.c \ +source/stm32lib/src/stm32f10x_crc.c \ +source/stm32lib/src/stm32f10x_dac.c \ +source/stm32lib/src/stm32f10x_dbgmcu.c \ +source/stm32lib/src/stm32f10x_dma.c \ +source/stm32lib/src/stm32f10x_exti.c \ +source/stm32lib/src/stm32f10x_flash.c \ +source/stm32lib/src/stm32f10x_fsmc.c \ +source/stm32lib/src/stm32f10x_gpio.c \ +source/stm32lib/src/stm32f10x_i2c.c \ +source/stm32lib/src/stm32f10x_iwdg.c \ +source/stm32lib/src/stm32f10x_pwr.c \ +source/stm32lib/src/stm32f10x_rcc.c \ +source/stm32lib/src/stm32f10x_rtc.c \ +source/stm32lib/src/stm32f10x_sdio.c \ +source/stm32lib/src/stm32f10x_spi.c \ +source/stm32lib/src/stm32f10x_tim.c \ +source/stm32lib/src/stm32f10x_usart.c \ +source/stm32lib/src/stm32f10x_wwdg.c \ +source/interface/if_rtt.c \ +source/interface/if_gpioout.c \ +source/interface/if_can.c \ +source/interface/if_gpioin.c \ +source/interface/if_uart.c \ +source/dev/dev_flash.c \ +source/dev/dev_backup.c \ +source/dev/dev_watchdog.c \ +source/rtt/SEGGER_RTT.c \ +source/rtt/SEGGER_RTT_printf.c \ +source/rt_thread/board.c \ +source/rt_thread/core_delay.c \ +source/rt_thread/libcpu/arm/cortex-m3/cpuport.c \ +source/rt_thread/src/clock.c \ +source/rt_thread/src/components.c \ +source/rt_thread/src/cpu.c \ +source/rt_thread/src/idle.c \ +source/rt_thread/src/ipc.c \ +source/rt_thread/src/irq.c \ +source/rt_thread/src/kservice.c \ +source/rt_thread/src/mem.c \ +source/rt_thread/src/memheap.c \ +source/rt_thread/src/mempool.c \ +source/rt_thread/src/object.c \ +source/rt_thread/src/scheduler.c \ +source/rt_thread/src/slab.c \ +source/rt_thread/src/thread.c \ +source/rt_thread/src/timer.c \ +source/soft/buff.c \ +source/soft/debug.c \ +source/soft/crc.c \ +source/soft/bytearray.c \ +source/soft/list.c \ +source/soft/mymisc.c \ +source/soft/mystdlib.c \ +source/soft/mystring.c \ +source/soft/signal.c \ +source/soft/sort.c \ +source/codec/codec.c \ +source/coder/coder_judge.c \ +source/coder/coder_lib.c \ +source/coder/JQ_PSDGenerate.c \ +source/coder/JQ_UIDGenerate.c \ +source/coder/PSDGenerate.c \ +source/task/commend.c \ +source/task/prot_uc.c \ +source/task/transmit.c \ +source/task/tran_for_slave.c \ +source/task/mod_signals.c \ +source/elec_det/base/delay.c \ +source/elec_det/base/utility.c \ +source/elec_det/driver/EWDriver.c \ +source/elec_det/driver/JQDriver.c \ +source/elec_det/driver/XTDriver.c \ +source/elec_det/hardware/adc_cfg.c \ +source/elec_det/hardware/dac_cfg.c \ +source/elec_det/hardware/gpio_cfg.c \ +source/elec_det/hardware/hardware.c \ +source/elec_det/hardware/jw3425iic.c \ +source/elec_det/hardware/power.c \ +source/elec_det/hardware/timer_cfg.c \ +source/elec_det/interface/BaseChecker.c \ +source/elec_det/interface/EWChecker.c \ +source/elec_det/interface/JQChecker.c \ +source/elec_det/interface/XTChecker.c \ +source/elec_det/test/EW_TestUsartApp.c \ +source/elec_det/test/EWCheckerTest.c \ +source/elec_det/test/Test.c \ +source/elec_det/test/XTCheckerTest.c \ +source/elec_det/elec_cmd.c \ +source/elec_det/elec_det.c \ +source/elec_det/elec_io.c \ +source/elec_det/elec_judge.c \ + + +# ASM sources +ASM_SOURCES = \ +source/core/startup_stm32f103xe.s \ +source/core/cortex_m4_gcc.s \ +source/rt_thread/libcpu/arm/cortex-m3/context_gcc.s \ + + +####################################### +# binaries +####################################### +PREFIX = arm-none-eabi- +# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) +# either it can be added to the PATH environment variable. +ifdef GCC_PATH +CC = $(GCC_PATH)/$(PREFIX)gcc +AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp +CP = $(GCC_PATH)/$(PREFIX)objcopy +SZ = $(GCC_PATH)/$(PREFIX)size +else +CC = $(PREFIX)gcc +AS = $(PREFIX)gcc -x assembler-with-cpp +CP = $(PREFIX)objcopy +SZ = $(PREFIX)size +endif +HEX = $(CP) -O ihex +BIN = $(CP) -O binary -S + +####################################### +# CFLAGS +####################################### +# cpu +CPU = -mcpu=cortex-m3 + +# fpu +# NONE for Cortex-M0/M0+/M3 + +# float-abi + + +# mcu +MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) + +# macros for gcc +# AS defines +AS_DEFS = + +# C defines +C_DEFS = \ +-DSTM32F10X_HD \ +-DUSE_STDPERIPH_DRIVER \ +-DRT_THREAD \ + + +# AS includes +AS_INCLUDES = + +# C includes +C_INCLUDES = \ +-Isource/codec \ +-Isource/coder \ +-Isource/core \ +-Isource/dev \ +-Isource/elec_det \ +-Isource/interface \ +-Isource/main \ +-Isource/rt_thread \ +-Isource/rt_thread/include \ +-Isource/RTT \ +-Isource/soft \ +-Isource/stm32lib/inc \ +-Isource/task \ + + +# compile gcc flags +ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections + +CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections + +ifeq ($(DEBUG), 1) +CFLAGS += -g -gdwarf-2 +endif + + +# ignore warnings +CFLAGS += -Wno-unused-but-set-variable -Wno-unused-function -Wno-unused-variable + + +# Generate dependency information +CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" + + +####################################### +# LDFLAGS +####################################### +# link script +LDSCRIPT = stm32_app.ld + +# libraries +LIBS = -lc -lm -lnosys +LIBDIR = +LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections + +# default action: build all +all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin + + +####################################### +# build the application +####################################### +# list of objects +OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) +vpath %.c $(sort $(dir $(C_SOURCES))) +# list of ASM program objects +OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) +vpath %.s $(sort $(dir $(ASM_SOURCES))) + +$(BUILD_DIR)/%.o: %.c $(SELF_NAME) | $(BUILD_DIR) + $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ + +$(BUILD_DIR)/%.o: %.s $(SELF_NAME) | $(BUILD_DIR) + $(AS) -c $(CFLAGS) $< -o $@ + +$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) $(SELF_NAME) + $(CC) $(OBJECTS) $(LDFLAGS) -o $@ + $(SZ) $@ + +$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) + $(HEX) $< $@ + +$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) + $(BIN) $< $@ + +$(BUILD_DIR): + mkdir $@ + +####################################### +# clean up +####################################### +clean: + -rm -fR $(BUILD_DIR) + +####################################### +# dependencies +####################################### +-include $(wildcard $(BUILD_DIR)/*.d) + +# *** EOF *** \ No newline at end of file diff --git a/Makeboot b/Makeboot index 3f7140b..d874b3a 100644 --- a/Makeboot +++ b/Makeboot @@ -217,7 +217,7 @@ $(BUILD_DIR): # clean up ####################################### clean: - -rm -fR $(BUILD_DIR) + -rm -R $(BUILD_DIR) ####################################### # dependencies diff --git a/checher_slave.uvprojx b/checher_slave.uvprojx index 87e9dab..876476d 100644 --- a/checher_slave.uvprojx +++ b/checher_slave.uvprojx @@ -185,6 +185,7 @@ 0 0 0 + 0 0 0 8 @@ -351,7 +352,7 @@ 0 0 0 - 0 + 4 @@ -798,7 +799,7 @@ 2 2 2 - 2 + 0 @@ -1892,7 +1893,7 @@ 2 2 2 - 2 + 0 @@ -2383,7 +2384,7 @@ 2 2 2 - 2 + 0 @@ -2482,7 +2483,7 @@ 2 2 2 - 2 + 0 @@ -2561,7 +2562,7 @@ 2 2 2 - 2 + 0 @@ -2810,6 +2811,7 @@ 0 0 0 + 0 0 0 8 @@ -2976,7 +2978,7 @@ 0 0 0 - 0 + 4 @@ -4079,7 +4081,7 @@ app_debug 0x4 ARM-ADS - 5060750::V5.06 update 6 (build 750)::ARMCC + 5060960::V5.06 update 7 (build 960)::.\ARMCC 0 @@ -4254,6 +4256,7 @@ 0 0 0 + 0 0 0 8 @@ -4420,7 +4423,7 @@ 0 0 0 - 0 + 4 diff --git a/source/ReadMe.txt b/source/ReadMe.txt index 3e8faca..397722a 100644 --- a/source/ReadMe.txt +++ b/source/ReadMe.txt @@ -238,4 +238,6 @@ 2023.11.1 使用make -f Makeboot 来使用gcc编译 添加 DMod_FireBusReadDatasV2_RC 函数 +2023.11.1 + make 对文件名是区分大小写的... diff --git a/source/elec_det/base/utility.c b/source/elec_det/base/utility.c index 3d812a1..645c5bf 100644 --- a/source/elec_det/base/utility.c +++ b/source/elec_det/base/utility.c @@ -72,7 +72,7 @@ uint32_t atoi32(const char* str,uint16_t base) *@param n:src num, str[5]:string buffer len:string size *@return void */ -void itoa(uint16_t n,uint8_t str[5], uint8_t len) +void myitoa(int n,char *str, int len) { uint8_t i=len-1; diff --git a/source/elec_det/base/utility.h b/source/elec_det/base/utility.h index f4cad87..c787250 100644 --- a/source/elec_det/base/utility.h +++ b/source/elec_det/base/utility.h @@ -7,7 +7,7 @@ float myatof(const char* str); uint16_t atoi16(const char* str,uint16_t base); /* Convert a string to integer number */ uint32_t atoi32(const char* str,uint16_t base); /* Convert a string to integer number */ -void itoa(uint16_t n,uint8_t* str, uint8_t len); +void myitoa(int n,char* str, int len); int validatoi(const char* str, int base, uint32_t* ret); /* Verify character string and Convert it to (hexa-)decimal. */ char c2d(uint8_t c); char d2c(uint8_t c); diff --git a/source/elec_det/elec_det.c b/source/elec_det/elec_det.c index b458811..d694c8e 100644 --- a/source/elec_det/elec_det.c +++ b/source/elec_det/elec_det.c @@ -40,9 +40,9 @@ typedef struct{ static self_def g_self; -int elec_check_scheme(void); -void elec_load_scheme(void); -int elec_parper_power(void); +static int elec_check_scheme(void); +static void elec_load_scheme(void); +static int elec_parper_power(void); // 初始化 diff --git a/source/main/compiler_info.h b/source/main/compiler_info.h index d156def..55816ea 100644 --- a/source/main/compiler_info.h +++ b/source/main/compiler_info.h @@ -6,7 +6,7 @@ -#define BUILD_DATE "2023-11-01 16:33:25" +#define BUILD_DATE "2023-11-01 23:50:38" #define SOFT_VERSION "2.03" diff --git a/source/rt_thread/board.c b/source/rt_thread/board.c index c2aec5c..c455739 100644 --- a/source/rt_thread/board.c +++ b/source/rt_thread/board.c @@ -79,10 +79,17 @@ void SysTick_Handler(void) void *dev_get(const char *name) { +#if defined (__CC_ARM) extern const int devstruct$$Base; extern const int devstruct$$Limit; struct dev_struct *start=(struct dev_struct *)&devstruct$$Base; struct dev_struct *end=(struct dev_struct *)&devstruct$$Limit; +#elif defined (__GNUC__) + extern const int __start_devstruct; + extern const int __stop_devstruct; + struct dev_struct *start=(struct dev_struct *)&__start_devstruct; + struct dev_struct *end=(struct dev_struct *)&__stop_devstruct; +#endif for(struct dev_struct *t=start;tname,name)==0) @@ -109,10 +116,17 @@ void param_err_handle(const char *param,const char *file,const char *fun,int lin void app_init(void) { +#if defined (__CC_ARM) extern const int initstruct$$Base; extern const int initstruct$$Limit; struct init_struct *start=(struct init_struct *)&initstruct$$Base; struct init_struct *end=(struct init_struct *)&initstruct$$Limit; +#elif defined (__GNUC__) + extern const int __start_initstruct; + extern const int __stop_initstruct; + struct init_struct *start=(struct init_struct *)&__start_initstruct; + struct init_struct *end=(struct init_struct *)&__stop_initstruct; +#endif int ret=0; for(struct init_struct *t=start;tsignal_==signal_) diff --git a/source/task/commend.c b/source/task/commend.c index 3bdee18..e9636c0 100644 --- a/source/task/commend.c +++ b/source/task/commend.c @@ -23,10 +23,17 @@ void *tappend(void *p,void *del); static commend_def *cmd_find(char *name) { +#if defined (__CC_ARM) extern const int cmdstruct$$Base; extern const int cmdstruct$$Limit; commend_def *start=(commend_def *)&cmdstruct$$Base; commend_def *end=(commend_def *)&cmdstruct$$Limit; +#else + extern const int __start_cmdstruct; + extern const int __stop_cmdstruct; + commend_def *start=(commend_def *)&__start_cmdstruct; + commend_def *end=(commend_def *)&__stop_cmdstruct; +#endif for(commend_def *t=start;tname,name)==0) @@ -114,10 +121,17 @@ int cmd_printf(const char *fmt,...) static int cmd_help(list_def *argv) { +#if defined (__CC_ARM) extern const int cmdstruct$$Base; extern const int cmdstruct$$Limit; commend_def *start=(commend_def *)&cmdstruct$$Base; commend_def *end=(commend_def *)&cmdstruct$$Limit; +#else + extern const int __start_cmdstruct; + extern const int __stop_cmdstruct; + commend_def *start=(commend_def *)&__start_cmdstruct; + commend_def *end=(commend_def *)&__stop_cmdstruct; +#endif cmd_print("help ->"); for(commend_def *t=start;tcodec->decode(p,data),strcmp(p->str_err,"ok")!=0)) { CHECK_DO(decode_data,arr_delete); +#if defined (__CC_ARM) extern const int codecstruct$$Base; extern const int codecstruct$$Limit; codec_item *start=(codec_item *)&codecstruct$$Base; codec_item *end=(codec_item *)&codecstruct$$Limit; +#else + extern const int __start_codecstruct; + extern const int __stop_codecstruct; + codec_item *start=(codec_item *)&__start_codecstruct; + codec_item *end=(codec_item *)&__stop_codecstruct; +#endif for(codec_item *t=start;tdecode(p,data); diff --git a/source/task/transmit.c b/source/task/transmit.c index 39354b3..fd001fa 100644 --- a/source/task/transmit.c +++ b/source/task/transmit.c @@ -124,10 +124,17 @@ int tran_get_busy(tran_def *t) static ucport_item *cmd_find(const char *codec_name,uint8_t cmd) { +#if defined (__CC_ARM) extern const int transtruct$$Base; extern const int transtruct$$Limit; ucport_item *start=(ucport_item *)&transtruct$$Base; ucport_item *end=(ucport_item *)&transtruct$$Limit; +#else + extern const int __start_transtruct; + extern const int __stop_transtruct; + ucport_item *start=(ucport_item *)&__start_transtruct; + ucport_item *end=(ucport_item *)&__stop_transtruct; +#endif for(ucport_item *t=start;tcmd==cmd)&&(strcmp(t->codec_name,codec_name)==0)) diff --git a/stm32_app.ld b/stm32_app.ld new file mode 100644 index 0000000..4312160 --- /dev/null +++ b/stm32_app.ld @@ -0,0 +1,189 @@ +/* +****************************************************************************** +** + +** File : LinkerScript.ld +** +** Author : STM32CubeMX +** +** Abstract : Linker script for STM32F103RCTx series +** 256Kbytes FLASH and 48Kbytes RAM +** +** Set heap size, stack size and stack location according +** to application requirements. +** +** Set memory bank area and size if external memory is used. +** +** Target : STMicroelectronics STM32 +** +** Distribution: The file is distributed “as is,” without any warranty +** of any kind. +** +***************************************************************************** +** @attention +** +**

© COPYRIGHT(c) 2019 STMicroelectronics

+** +** Redistribution and use in source and binary forms, with or without modification, +** are permitted provided that the following conditions are met: +** 1. Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation +** and/or other materials provided with the distribution. +** 3. Neither the name of STMicroelectronics nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +***************************************************************************** +*/ + +/* Entry Point */ +ENTRY(Reset_Handler) + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */ +/* Generate a link error if heap and stack don't fit into RAM */ +_Min_Heap_Size = 0x000; /* required amount of heap */ +_Min_Stack_Size = 0x400; /* required amount of stack */ + +/* Specify the memory areas */ +MEMORY +{ +RAM (xrw) : ORIGIN = 0x20000020, LENGTH = 0xbfe0 +FLASH (rx) : ORIGIN = 0x8004000, LENGTH = 240K +} + +/* Define output sections */ +SECTIONS +{ + /* The startup code goes first into FLASH */ + .isr_vector : + { + . = ALIGN(4); + KEEP(*(.isr_vector)) /* Startup code */ + . = ALIGN(4); + } >FLASH + + /* The program code and other data goes into FLASH */ + .text : + { + . = ALIGN(4); + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data goes into FLASH */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH + .ARM : { + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + } >FLASH + + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } >FLASH + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + } >FLASH + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + } >FLASH + + /* used by the startup to initialize data */ + _sidata = LOADADDR(.data); + + /* Initialized data sections goes into RAM, load LMA copy after code */ + .data : + { + . = ALIGN(4); + _sdata = .; /* create a global symbol at data start */ + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + + . = ALIGN(4); + _edata = .; /* define a global symbol at data end */ + } >RAM AT> FLASH + + + /* Uninitialized data section */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss secion */ + _sbss = .; /* define a global symbol at bss start */ + __bss_start__ = _sbss; + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + _ebss = .; /* define a global symbol at bss end */ + __bss_end__ = _ebss; + } >RAM + + /* User_heap_stack section, used to check that there is enough RAM left */ + ._user_heap_stack : + { + . = ALIGN(8); + PROVIDE ( end = . ); + PROVIDE ( _end = . ); + . = . + _Min_Heap_Size; + . = . + _Min_Stack_Size; + . = ALIGN(8); + } >RAM + + + + /* Remove information from the standard libraries */ + /DISCARD/ : + { + libc.a ( * ) + libm.a ( * ) + libgcc.a ( * ) + } + + .ARM.attributes 0 : { *(.ARM.attributes) } +} + + diff --git a/stm32_boot.ld b/stm32_boot.ld index 73fe775..acff3f7 100644 --- a/stm32_boot.ld +++ b/stm32_boot.ld @@ -55,14 +55,14 @@ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ -_Min_Heap_Size = 0x200; /* required amount of heap */ +_Min_Heap_Size = 0x000; /* required amount of heap */ _Min_Stack_Size = 0x400; /* required amount of stack */ /* Specify the memory areas */ MEMORY { -RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K -FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K +RAM (xrw) : ORIGIN = 0x20000020, LENGTH = 0xbfe0 +FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K } /* Define output sections */