gcc和mdk都能编译成功

This commit is contained in:
andy
2023-11-01 23:51:19 +08:00
parent ddeec88a89
commit 17729e664f
17 changed files with 563 additions and 27 deletions

View File

@@ -5,6 +5,7 @@
"includePath": [ "includePath": [
"${workspaceFolder}/**", "${workspaceFolder}/**",
"${workspaceFolder}/source/**", "${workspaceFolder}/source/**",
"${workspaceFolder}/source/soft",
"D:/GNU Arm Embedded Toolchain/10 2021.10/arm-none-eabi/include" "D:/GNU Arm Embedded Toolchain/10 2021.10/arm-none-eabi/include"
], ],
"defines": [ "defines": [

View File

@@ -4,6 +4,8 @@
"signal.h": "c", "signal.h": "c",
"dev_flash.h": "c", "dev_flash.h": "c",
"opt.h": "c", "opt.h": "c",
"if_can.h": "c" "if_can.h": "c",
"board.h": "c",
"prot_uc.h": "c"
} }
} }

290
Makeapp Normal file
View File

@@ -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 ***

View File

@@ -217,7 +217,7 @@ $(BUILD_DIR):
# clean up # clean up
####################################### #######################################
clean: clean:
-rm -fR $(BUILD_DIR) -rm -R $(BUILD_DIR)
####################################### #######################################
# dependencies # dependencies

View File

@@ -185,6 +185,7 @@
<uocXRam>0</uocXRam> <uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP> <RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve> <RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<hadIRAM2>0</hadIRAM2> <hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2> <hadIROM2>0</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
@@ -351,7 +352,7 @@
<NoWarn>0</NoWarn> <NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<useXO>0</useXO> <useXO>0</useXO>
<uClangAs>0</uClangAs> <ClangAsOpt>4</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@@ -798,7 +799,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@@ -1892,7 +1893,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@@ -2383,7 +2384,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@@ -2482,7 +2483,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@@ -2561,7 +2562,7 @@
<NoWarn>2</NoWarn> <NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc> <uSurpInc>2</uSurpInc>
<useXO>2</useXO> <useXO>2</useXO>
<uClangAs>2</uClangAs> <ClangAsOpt>0</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@@ -2810,6 +2811,7 @@
<uocXRam>0</uocXRam> <uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP> <RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve> <RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<hadIRAM2>0</hadIRAM2> <hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2> <hadIROM2>0</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
@@ -2976,7 +2978,7 @@
<NoWarn>0</NoWarn> <NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<useXO>0</useXO> <useXO>0</useXO>
<uClangAs>0</uClangAs> <ClangAsOpt>4</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>
@@ -4079,7 +4081,7 @@
<TargetName>app_debug</TargetName> <TargetName>app_debug</TargetName>
<ToolsetNumber>0x4</ToolsetNumber> <ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName> <ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed> <pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
<uAC6>0</uAC6> <uAC6>0</uAC6>
<TargetOption> <TargetOption>
<TargetCommonOption> <TargetCommonOption>
@@ -4254,6 +4256,7 @@
<uocXRam>0</uocXRam> <uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP> <RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve> <RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<hadIRAM2>0</hadIRAM2> <hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2> <hadIROM2>0</hadIROM2>
<StupSel>8</StupSel> <StupSel>8</StupSel>
@@ -4420,7 +4423,7 @@
<NoWarn>0</NoWarn> <NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<useXO>0</useXO> <useXO>0</useXO>
<uClangAs>0</uClangAs> <ClangAsOpt>4</ClangAsOpt>
<VariousControls> <VariousControls>
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define></Define> <Define></Define>

View File

@@ -238,4 +238,6 @@
2023.11.1 2023.11.1
使用make -f Makeboot 来使用gcc编译 使用make -f Makeboot 来使用gcc编译
添加 DMod_FireBusReadDatasV2_RC 函数 添加 DMod_FireBusReadDatasV2_RC 函数
2023.11.1
make 对文件名是区分大小写的...

View File

@@ -72,7 +72,7 @@ uint32_t atoi32(const char* str,uint16_t base)
*@param n:src num str[5]:string buffer lenstring size *@param n:src num str[5]:string buffer lenstring size
*@return void *@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; uint8_t i=len-1;

View File

@@ -7,7 +7,7 @@
float myatof(const char* str); float myatof(const char* str);
uint16_t atoi16(const char* str,uint16_t base); /* Convert a string to integer number */ 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 */ 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. */ 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 c2d(uint8_t c);
char d2c(uint8_t c); char d2c(uint8_t c);

View File

@@ -40,9 +40,9 @@ typedef struct{
static self_def g_self; static self_def g_self;
int elec_check_scheme(void); static int elec_check_scheme(void);
void elec_load_scheme(void); static void elec_load_scheme(void);
int elec_parper_power(void); static int elec_parper_power(void);
// 初始化 // 初始化

View File

@@ -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" #define SOFT_VERSION "2.03"

View File

@@ -79,10 +79,17 @@ void SysTick_Handler(void)
void *dev_get(const char *name) void *dev_get(const char *name)
{ {
#if defined (__CC_ARM)
extern const int devstruct$$Base; extern const int devstruct$$Base;
extern const int devstruct$$Limit; extern const int devstruct$$Limit;
struct dev_struct *start=(struct dev_struct *)&devstruct$$Base; struct dev_struct *start=(struct dev_struct *)&devstruct$$Base;
struct dev_struct *end=(struct dev_struct *)&devstruct$$Limit; 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;t<end;t++) for(struct dev_struct *t=start;t<end;t++)
{ {
if(strcmp(t->name,name)==0) if(strcmp(t->name,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) void app_init(void)
{ {
#if defined (__CC_ARM)
extern const int initstruct$$Base; extern const int initstruct$$Base;
extern const int initstruct$$Limit; extern const int initstruct$$Limit;
struct init_struct *start=(struct init_struct *)&initstruct$$Base; struct init_struct *start=(struct init_struct *)&initstruct$$Base;
struct init_struct *end=(struct init_struct *)&initstruct$$Limit; 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; int ret=0;
for(struct init_struct *t=start;t<end;t++) for(struct init_struct *t=start;t<end;t++)
{ {

View File

@@ -37,13 +37,13 @@ int signal_init(void)
static void cpy4byte(uint32_t *dst,uint32_t *src,int num_4byte) // static void cpy4byte(uint32_t *dst,uint32_t *src,int num_4byte)
{ // {
for(int i=0;i<num_4byte;i++) // for(int i=0;i<num_4byte;i++)
{ // {
dst[i]=src[i]; // dst[i]=src[i];
} // }
} // }
@@ -235,10 +235,17 @@ int disconnect_slot(void *slot_obj)
signal_def *signal_find(void *signal_) signal_def *signal_find(void *signal_)
{ {
#if defined (__CC_ARM)
extern const int signalstruct$$Base; extern const int signalstruct$$Base;
extern const int signalstruct$$Limit; extern const int signalstruct$$Limit;
signal_def *start=(signal_def *)&signalstruct$$Base; signal_def *start=(signal_def *)&signalstruct$$Base;
signal_def *end=(signal_def *)&signalstruct$$Limit; signal_def *end=(signal_def *)&signalstruct$$Limit;
#else
extern const int __start_signalstruct;
extern const int __stop_signalstruct;
signal_def *start=(signal_def *)&__start_signalstruct;
signal_def *end=(signal_def *)&__stop_signalstruct;
#endif
for(signal_def *t=start;t<end;t++) for(signal_def *t=start;t<end;t++)
{ {
if(t->signal_==signal_) if(t->signal_==signal_)

View File

@@ -23,10 +23,17 @@ void *tappend(void *p,void *del);
static commend_def *cmd_find(char *name) static commend_def *cmd_find(char *name)
{ {
#if defined (__CC_ARM)
extern const int cmdstruct$$Base; extern const int cmdstruct$$Base;
extern const int cmdstruct$$Limit; extern const int cmdstruct$$Limit;
commend_def *start=(commend_def *)&cmdstruct$$Base; commend_def *start=(commend_def *)&cmdstruct$$Base;
commend_def *end=(commend_def *)&cmdstruct$$Limit; 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;t<end;t++) for(commend_def *t=start;t<end;t++)
{ {
if(strcmp(t->name,name)==0) if(strcmp(t->name,name)==0)
@@ -114,10 +121,17 @@ int cmd_printf(const char *fmt,...)
static int cmd_help(list_def *argv) static int cmd_help(list_def *argv)
{ {
#if defined (__CC_ARM)
extern const int cmdstruct$$Base; extern const int cmdstruct$$Base;
extern const int cmdstruct$$Limit; extern const int cmdstruct$$Limit;
commend_def *start=(commend_def *)&cmdstruct$$Base; commend_def *start=(commend_def *)&cmdstruct$$Base;
commend_def *end=(commend_def *)&cmdstruct$$Limit; 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 ->"); cmd_print("help ->");
for(commend_def *t=start;t<end;t++) for(commend_def *t=start;t<end;t++)
{ {

View File

@@ -135,10 +135,17 @@ static array_def *protu_try_decode(protu_def *p,array_def *data)
(decode_data=p->codec->decode(p,data),strcmp(p->str_err,"ok")!=0)) (decode_data=p->codec->decode(p,data),strcmp(p->str_err,"ok")!=0))
{ {
CHECK_DO(decode_data,arr_delete); CHECK_DO(decode_data,arr_delete);
#if defined (__CC_ARM)
extern const int codecstruct$$Base; extern const int codecstruct$$Base;
extern const int codecstruct$$Limit; extern const int codecstruct$$Limit;
codec_item *start=(codec_item *)&codecstruct$$Base; codec_item *start=(codec_item *)&codecstruct$$Base;
codec_item *end=(codec_item *)&codecstruct$$Limit; 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;t<end;t++) for(codec_item *t=start;t<end;t++)
{ {
decode_data=t->decode(p,data); decode_data=t->decode(p,data);

View File

@@ -124,10 +124,17 @@ int tran_get_busy(tran_def *t)
static ucport_item *cmd_find(const char *codec_name,uint8_t cmd) 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$$Base;
extern const int transtruct$$Limit; extern const int transtruct$$Limit;
ucport_item *start=(ucport_item *)&transtruct$$Base; ucport_item *start=(ucport_item *)&transtruct$$Base;
ucport_item *end=(ucport_item *)&transtruct$$Limit; 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;t<end;t++) for(ucport_item *t=start;t<end;t++)
{ {
if((t->cmd==cmd)&&(strcmp(t->codec_name,codec_name)==0)) if((t->cmd==cmd)&&(strcmp(t->codec_name,codec_name)==0))

189
stm32_app.ld Normal file
View File

@@ -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
**
** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
**
** 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) }
}

View File

@@ -55,14 +55,14 @@ ENTRY(Reset_Handler)
/* Highest address of the user mode stack */ /* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */ _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
/* Generate a link error if heap and stack don't fit into 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 */ _Min_Stack_Size = 0x400; /* required amount of stack */
/* Specify the memory areas */ /* Specify the memory areas */
MEMORY MEMORY
{ {
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K RAM (xrw) : ORIGIN = 0x20000020, LENGTH = 0xbfe0
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K
} }
/* Define output sections */ /* Define output sections */