WiP
This commit is contained in:
@@ -126,4 +126,6 @@ void reboot() {
|
|||||||
void delay_ms(uint16_t count) {
|
void delay_ms(uint16_t count) {
|
||||||
delay_1ms(count);
|
delay_1ms(count);
|
||||||
}
|
}
|
||||||
|
uint32_t __get_IPSR(void) {
|
||||||
|
return 0; // To shut-up CMSIS
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#endif /* __riscv_xlen */
|
#endif /* __riscv_xlen */
|
||||||
|
|
||||||
#define REGBYTES (1 << LOG_REGBYTES)
|
#define REGBYTES (1 << LOG_REGBYTES)
|
||||||
|
#ifdef __riscv_flen
|
||||||
#if __riscv_flen == 64
|
#if __riscv_flen == 64
|
||||||
# define FPSTORE fsd
|
# define FPSTORE fsd
|
||||||
# define FPLOAD fld
|
# define FPLOAD fld
|
||||||
@@ -47,6 +47,8 @@
|
|||||||
# define FPLOAD flw
|
# define FPLOAD flw
|
||||||
# define LOG_FPREGBYTES 2
|
# define LOG_FPREGBYTES 2
|
||||||
#endif /* __riscv_flen */
|
#endif /* __riscv_flen */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FPREGBYTES (1 << LOG_FPREGBYTES)
|
#define FPREGBYTES (1 << LOG_FPREGBYTES)
|
||||||
|
|
||||||
#define __rv_likely(x) __builtin_expect((x), 1)
|
#define __rv_likely(x) __builtin_expect((x), 1)
|
||||||
|
|||||||
@@ -254,7 +254,17 @@ SECTIONS
|
|||||||
*(.sdata .sdata.* .sdata*)
|
*(.sdata .sdata.* .sdata*)
|
||||||
*(.gnu.linkonce.s.*)
|
*(.gnu.linkonce.s.*)
|
||||||
} >ram AT>flash
|
} >ram AT>flash
|
||||||
|
.logo_page (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ABSOLUTE(__FLASH_END_ADDR__ - 2048);
|
||||||
|
KEEP (*(.logo_page*))
|
||||||
|
} > ROM
|
||||||
|
|
||||||
|
.settings_page (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ABSOLUTE(__FLASH_END_ADDR__ - 1024);
|
||||||
|
KEEP (*(.settings_page*))
|
||||||
|
} > ROM
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
PROVIDE( _edata = . );
|
PROVIDE( _edata = . );
|
||||||
PROVIDE( edata = . );
|
PROVIDE( edata = . );
|
||||||
|
|||||||
@@ -89,12 +89,3 @@ void eclic_system_reset(void) {
|
|||||||
REG32(REG_DBGMCU2) = 0x1;
|
REG32(REG_DBGMCU2) = 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief send event(SEV)
|
|
||||||
\param[in] none
|
|
||||||
\param[out] none
|
|
||||||
\retval none
|
|
||||||
*/
|
|
||||||
void eclic_send_event(void) {
|
|
||||||
set_csr(0x812, 0x1);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -93,8 +93,7 @@ uint32_t SystemCoreClock = __SYSTEM_CLOCK_108M_PLL_HXTAL; /* System Clock Frequ
|
|||||||
\retval none
|
\retval none
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void system_clock_108m_hxtal(void)
|
static void system_clock_108m_hxtal(void) {
|
||||||
{
|
|
||||||
uint32_t timeout = 0U;
|
uint32_t timeout = 0U;
|
||||||
uint32_t stab_flag = 0U;
|
uint32_t stab_flag = 0U;
|
||||||
|
|
||||||
@@ -184,12 +183,10 @@ static void system_clock_108m_hxtal(void)
|
|||||||
\param[out] none
|
\param[out] none
|
||||||
\retval none
|
\retval none
|
||||||
*/
|
*/
|
||||||
static void system_clock_config(void)
|
static void system_clock_config(void) {
|
||||||
{
|
|
||||||
system_clock_108m_hxtal();
|
system_clock_108m_hxtal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Function to update the variable \ref SystemCoreClock
|
* \brief Function to update the variable \ref SystemCoreClock
|
||||||
* \details
|
* \details
|
||||||
@@ -285,8 +282,7 @@ void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
|
|||||||
* with a variable clock speed, it updates the variable \ref SystemCoreClock.
|
* with a variable clock speed, it updates the variable \ref SystemCoreClock.
|
||||||
* SystemInit is called from the file <b>startup<i>_device</i></b>.
|
* SystemInit is called from the file <b>startup<i>_device</i></b>.
|
||||||
*/
|
*/
|
||||||
void SystemInit (void)
|
void SystemInit(void) {
|
||||||
{
|
|
||||||
/* ToDo: add code to initialize the system
|
/* ToDo: add code to initialize the system
|
||||||
* Warn: do not use global variables because this function is called before
|
* Warn: do not use global variables because this function is called before
|
||||||
* reaching pre-main. RW section maybe overwritten afterwards.
|
* reaching pre-main. RW section maybe overwritten afterwards.
|
||||||
@@ -296,7 +292,8 @@ void SystemInit (void)
|
|||||||
RCU_CTL |= RCU_CTL_IRC8MEN;
|
RCU_CTL |= RCU_CTL_IRC8MEN;
|
||||||
|
|
||||||
/* reset SCS, AHBPSC, APB1PSC, APB2PSC, ADCPSC, CKOUT0SEL bits */
|
/* reset SCS, AHBPSC, APB1PSC, APB2PSC, ADCPSC, CKOUT0SEL bits */
|
||||||
RCU_CFG0 &= ~(RCU_CFG0_SCS | RCU_CFG0_AHBPSC | RCU_CFG0_APB1PSC | RCU_CFG0_APB2PSC |
|
RCU_CFG0 &= ~(RCU_CFG0_SCS | RCU_CFG0_AHBPSC | RCU_CFG0_APB1PSC
|
||||||
|
| RCU_CFG0_APB2PSC |
|
||||||
RCU_CFG0_ADCPSC | RCU_CFG0_ADCPSC_2 | RCU_CFG0_CKOUT0SEL);
|
RCU_CFG0_ADCPSC | RCU_CFG0_ADCPSC_2 | RCU_CFG0_CKOUT0SEL);
|
||||||
|
|
||||||
/* reset HXTALEN, CKMEN, PLLEN bits */
|
/* reset HXTALEN, CKMEN, PLLEN bits */
|
||||||
@@ -312,7 +309,8 @@ void SystemInit (void)
|
|||||||
RCU_CFG1 = 0x00000000U;
|
RCU_CFG1 = 0x00000000U;
|
||||||
|
|
||||||
/* Reset HXTALEN, CKMEN, PLLEN, PLL1EN and PLL2EN bits */
|
/* Reset HXTALEN, CKMEN, PLLEN, PLL1EN and PLL2EN bits */
|
||||||
RCU_CTL &= ~(RCU_CTL_PLLEN | RCU_CTL_PLL1EN | RCU_CTL_PLL2EN | RCU_CTL_CKMEN | RCU_CTL_HXTALEN);
|
RCU_CTL &= ~(RCU_CTL_PLLEN | RCU_CTL_PLL1EN | RCU_CTL_PLL2EN | RCU_CTL_CKMEN
|
||||||
|
| RCU_CTL_HXTALEN);
|
||||||
/* disable all interrupts */
|
/* disable all interrupts */
|
||||||
RCU_INT = 0x00FF0000U;
|
RCU_INT = 0x00FF0000U;
|
||||||
|
|
||||||
@@ -356,13 +354,14 @@ typedef void (*EXC_HANDLER) (unsigned long mcause, unsigned long sp);
|
|||||||
* This function provided a default exception and NMI handling code for all exception ids.
|
* This function provided a default exception and NMI handling code for all exception ids.
|
||||||
* By default, It will just print some information for debug, Vendor can customize it according to its requirements.
|
* By default, It will just print some information for debug, Vendor can customize it according to its requirements.
|
||||||
*/
|
*/
|
||||||
static void system_default_exception_handler(unsigned long mcause, unsigned long sp)
|
static void system_default_exception_handler(unsigned long mcause,
|
||||||
{
|
unsigned long sp) {
|
||||||
/* TODO: Uncomment this if you have implement printf function */
|
/* TODO: Uncomment this if you have implement printf function */
|
||||||
printf("MCAUSE: 0x%lx\r\n", mcause);
|
printf("MCAUSE: 0x%lx\r\n", mcause);
|
||||||
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
printf("MEPC : 0x%lx\r\n", __RV_CSR_READ(CSR_MEPC));
|
||||||
printf("MTVAL : 0x%lx\r\n", __RV_CSR_READ(CSR_MBADADDR));
|
printf("MTVAL : 0x%lx\r\n", __RV_CSR_READ(CSR_MBADADDR));
|
||||||
while(1);
|
while (1)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -372,10 +371,10 @@ static void system_default_exception_handler(unsigned long mcause, unsigned long
|
|||||||
* \note
|
* \note
|
||||||
* Called in \ref _init function, used to initialize default exception handlers for all exception IDs
|
* Called in \ref _init function, used to initialize default exception handlers for all exception IDs
|
||||||
*/
|
*/
|
||||||
static void Exception_Init(void)
|
static void Exception_Init(void) {
|
||||||
{
|
|
||||||
for (int i = 0; i < MAX_SYSTEM_EXCEPTION_NUM + 1; i++) {
|
for (int i = 0; i < MAX_SYSTEM_EXCEPTION_NUM + 1; i++) {
|
||||||
SystemExceptionHandlers[i] = (unsigned long)system_default_exception_handler;
|
SystemExceptionHandlers[i] =
|
||||||
|
(unsigned long) system_default_exception_handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,9 +386,8 @@ static void Exception_Init(void)
|
|||||||
* \param EXCn See \ref EXCn_Type
|
* \param EXCn See \ref EXCn_Type
|
||||||
* \param exc_handler The exception handler for this exception code EXCn
|
* \param exc_handler The exception handler for this exception code EXCn
|
||||||
*/
|
*/
|
||||||
void Exception_Register_EXC(uint32_t EXCn, unsigned long exc_handler)
|
void Exception_Register_EXC(uint32_t EXCn, unsigned long exc_handler) {
|
||||||
{
|
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM)) {
|
||||||
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) {
|
|
||||||
SystemExceptionHandlers[EXCn] = exc_handler;
|
SystemExceptionHandlers[EXCn] = exc_handler;
|
||||||
} else if (EXCn == NMI_EXCn) {
|
} else if (EXCn == NMI_EXCn) {
|
||||||
SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM] = exc_handler;
|
SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM] = exc_handler;
|
||||||
@@ -404,9 +402,8 @@ void Exception_Register_EXC(uint32_t EXCn, unsigned long exc_handler)
|
|||||||
* \param EXCn See \ref EXCn_Type
|
* \param EXCn See \ref EXCn_Type
|
||||||
* \return Current exception handler for exception code EXCn, if not found, return 0.
|
* \return Current exception handler for exception code EXCn, if not found, return 0.
|
||||||
*/
|
*/
|
||||||
unsigned long Exception_Get_EXC(uint32_t EXCn)
|
unsigned long Exception_Get_EXC(uint32_t EXCn) {
|
||||||
{
|
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM)) {
|
||||||
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) {
|
|
||||||
return SystemExceptionHandlers[EXCn];
|
return SystemExceptionHandlers[EXCn];
|
||||||
} else if (EXCn == NMI_EXCn) {
|
} else if (EXCn == NMI_EXCn) {
|
||||||
return SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM];
|
return SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM];
|
||||||
@@ -426,15 +423,15 @@ unsigned long Exception_Get_EXC(uint32_t EXCn)
|
|||||||
* - For the core_exception_handler template, we provided exception register function \ref Exception_Register_EXC
|
* - For the core_exception_handler template, we provided exception register function \ref Exception_Register_EXC
|
||||||
* which can help developer to register your exception handler for specific exception number.
|
* which can help developer to register your exception handler for specific exception number.
|
||||||
*/
|
*/
|
||||||
uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
|
uint32_t core_exception_handler(unsigned long mcause, unsigned long sp) {
|
||||||
{
|
|
||||||
uint32_t EXCn = (uint32_t) (mcause & 0X00000fff);
|
uint32_t EXCn = (uint32_t) (mcause & 0X00000fff);
|
||||||
EXC_HANDLER exc_handler;
|
EXC_HANDLER exc_handler;
|
||||||
|
|
||||||
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM) && (EXCn >= 0)) {
|
if ((EXCn < MAX_SYSTEM_EXCEPTION_NUM)) {
|
||||||
exc_handler = (EXC_HANDLER) SystemExceptionHandlers[EXCn];
|
exc_handler = (EXC_HANDLER) SystemExceptionHandlers[EXCn];
|
||||||
} else if (EXCn == NMI_EXCn) {
|
} else if (EXCn == NMI_EXCn) {
|
||||||
exc_handler = (EXC_HANDLER)SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM];
|
exc_handler =
|
||||||
|
(EXC_HANDLER) SystemExceptionHandlers[MAX_SYSTEM_EXCEPTION_NUM];
|
||||||
} else {
|
} else {
|
||||||
exc_handler = (EXC_HANDLER) system_default_exception_handler;
|
exc_handler = (EXC_HANDLER) system_default_exception_handler;
|
||||||
}
|
}
|
||||||
@@ -445,8 +442,7 @@ uint32_t core_exception_handler(unsigned long mcause, unsigned long sp)
|
|||||||
}
|
}
|
||||||
/** @} *//* End of Doxygen Group NMSIS_Core_ExceptionAndNMI */
|
/** @} *//* End of Doxygen Group NMSIS_Core_ExceptionAndNMI */
|
||||||
|
|
||||||
void SystemBannerPrint(void)
|
void SystemBannerPrint(void) {
|
||||||
{
|
|
||||||
#if defined(NUCLEI_BANNER) && (NUCLEI_BANNER == 1)
|
#if defined(NUCLEI_BANNER) && (NUCLEI_BANNER == 1)
|
||||||
#ifndef DOWNLOAD_MODE
|
#ifndef DOWNLOAD_MODE
|
||||||
#error DOWNLOAD_MODE is not defined via build system, please check!
|
#error DOWNLOAD_MODE is not defined via build system, please check!
|
||||||
@@ -464,8 +460,7 @@ void SystemBannerPrint(void)
|
|||||||
* Eclic need initialize after boot up, Vendor could also change the initialization
|
* Eclic need initialize after boot up, Vendor could also change the initialization
|
||||||
* configuration.
|
* configuration.
|
||||||
*/
|
*/
|
||||||
void ECLIC_Init(void)
|
void ECLIC_Init(void) {
|
||||||
{
|
|
||||||
/* TODO: Add your own initialization code here. This function will be called by main */
|
/* TODO: Add your own initialization code here. This function will be called by main */
|
||||||
ECLIC_SetMth(0);
|
ECLIC_SetMth(0);
|
||||||
ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS);
|
ECLIC_SetCfgNlbits(__ECLIC_INTCTLBITS);
|
||||||
@@ -487,9 +482,10 @@ void ECLIC_Init(void)
|
|||||||
* - This function use to configure specific eclic interrupt and register its interrupt handler and enable its interrupt.
|
* - This function use to configure specific eclic interrupt and register its interrupt handler and enable its interrupt.
|
||||||
* - If the vector table is placed in read-only section(FLASHXIP mode), handler could not be installed
|
* - If the vector table is placed in read-only section(FLASHXIP mode), handler could not be installed
|
||||||
*/
|
*/
|
||||||
int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_mode, uint8_t lvl, uint8_t priority, void *handler)
|
int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv,
|
||||||
{
|
ECLIC_TRIGGER_Type trig_mode, uint8_t lvl, uint8_t priority,
|
||||||
if ((IRQn > SOC_INT_MAX) || (shv > ECLIC_VECTOR_INTERRUPT) \
|
void *handler) {
|
||||||
|
if ((IRQn > SOC_INT_MAX) || (shv > ECLIC_VECTOR_INTERRUPT)
|
||||||
|| (trig_mode > ECLIC_NEGTIVE_EDGE_TRIGGER)) {
|
|| (trig_mode > ECLIC_NEGTIVE_EDGE_TRIGGER)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -520,8 +516,7 @@ int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_
|
|||||||
* by __libc_init_array function, so we defined a new function
|
* by __libc_init_array function, so we defined a new function
|
||||||
* to do initialization
|
* to do initialization
|
||||||
*/
|
*/
|
||||||
void _premain_init(void)
|
void _premain_init(void) {
|
||||||
{
|
|
||||||
/* TODO: Add your own initialization code here, called before main */
|
/* TODO: Add your own initialization code here, called before main */
|
||||||
SystemCoreClock = get_cpu_freq();
|
SystemCoreClock = get_cpu_freq();
|
||||||
/* Initialize exception default handlers */
|
/* Initialize exception default handlers */
|
||||||
@@ -539,8 +534,7 @@ void _premain_init(void)
|
|||||||
* by __libc_fini_array function, so we defined a new function
|
* by __libc_fini_array function, so we defined a new function
|
||||||
* to do initialization
|
* to do initialization
|
||||||
*/
|
*/
|
||||||
void _postmain_fini(int status)
|
void _postmain_fini(int status) {
|
||||||
{
|
|
||||||
/* TODO: Add your own finishing code here, called after main */
|
/* TODO: Add your own finishing code here, called after main */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,8 +547,7 @@ void _postmain_fini(int status)
|
|||||||
* \note
|
* \note
|
||||||
* Please use \ref _premain_init function now
|
* Please use \ref _premain_init function now
|
||||||
*/
|
*/
|
||||||
void _init(void)
|
void _init(void) {
|
||||||
{
|
|
||||||
/* Don't put any code here, please use _premain_init now */
|
/* Don't put any code here, please use _premain_init now */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,8 +560,7 @@ void _init(void)
|
|||||||
* \note
|
* \note
|
||||||
* Please use \ref _postmain_fini function now
|
* Please use \ref _postmain_fini function now
|
||||||
*/
|
*/
|
||||||
void _fini(void)
|
void _fini(void) {
|
||||||
{
|
|
||||||
/* Don't put any code here, please use _postmain_fini now */
|
/* Don't put any code here, please use _postmain_fini now */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,12 +46,12 @@ LDSCRIPT=stm32f103.ld
|
|||||||
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
DEV_GLOBAL_DEFS= -D STM32F103T8Ux -D STM32F1 -D STM32 -D USE_HAL_DRIVER -D STM32F103xB -D USE_RTOS_SYSTICK -D GCC_ARMCM3 \
|
||||||
-D ARM_MATH_CM3 \
|
-D ARM_MATH_CM3 \
|
||||||
-D STM32F10X_MD
|
-D STM32F10X_MD
|
||||||
DEV_LDFLAGS=-lm -Wl,--gc-sections -flto
|
DEV_LDFLAGS=-lm -Wl,--gc-sections
|
||||||
DEV_AFLAGS=
|
DEV_AFLAGS=
|
||||||
DEV_CFLAGS=-flto -D GCC_ARMCM3 \
|
DEV_CFLAGS= -D GCC_ARMCM3 \
|
||||||
-D ARM_MATH_CM3 \
|
-D ARM_MATH_CM3 \
|
||||||
-D STM32F10X_MD
|
-D STM32F10X_MD
|
||||||
DEV_CXXFLAGS=-flto -D GCC_ARMCM3 \
|
DEV_CXXFLAGS= -D GCC_ARMCM3 \
|
||||||
-D ARM_MATH_CM3 \
|
-D ARM_MATH_CM3 \
|
||||||
-D STM32F10X_MD
|
-D STM32F10X_MD
|
||||||
CPUFLAGS= -mcpu=cortex-m3 \
|
CPUFLAGS= -mcpu=cortex-m3 \
|
||||||
@@ -79,13 +79,12 @@ bootldr_size=0x0
|
|||||||
# Flags
|
# Flags
|
||||||
CPUFLAGS= -march=rv32imac \
|
CPUFLAGS= -march=rv32imac \
|
||||||
-mabi=ilp32 \
|
-mabi=ilp32 \
|
||||||
-mtune=size \
|
-mcmodel=medany -fsigned-char -fno-builtin -fsingle-precision-constant \
|
||||||
-mcmodel=medlow \
|
-DRTOS_FREERTOS -DDOWNLOAD_MODE=DOWNLOAD_MODE_FLASHXIP
|
||||||
-DGD32VF103C_START \
|
|
||||||
-DUSE_STDPERIPH_DRIVER
|
DEV_LDFLAGS= -lstdc++ -nostartfiles -Xlinker --gc-sections --specs=nosys.specs -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
|
||||||
DEV_LDFLAGS= -nostartfiles -Xlinker --gc-sections
|
DEV_AFLAGS= -nostartfiles -ffreestanding -fno-common -Os -flto
|
||||||
DEV_AFLAGS= -nostartfiles -ffreestanding
|
DEV_GLOBAL_DEFS=
|
||||||
DEV_GLOBAL_DEFS=-msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fabi-version=11
|
|
||||||
DEV_CFLAGS= -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
|
DEV_CFLAGS= -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
|
||||||
DEV_CXXFLAGS= -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
|
DEV_CXXFLAGS= -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
|
||||||
endif
|
endif
|
||||||
@@ -116,8 +115,7 @@ HEXFILE_DIR=Hexfile
|
|||||||
OUTPUT_DIR_BASE=Objects
|
OUTPUT_DIR_BASE=Objects
|
||||||
OUTPUT_DIR=Objects/$(model)
|
OUTPUT_DIR=Objects/$(model)
|
||||||
# code optimisation ------------------------------------------------------------
|
# code optimisation ------------------------------------------------------------
|
||||||
OPTIM=-Os -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections
|
OPTIM=-Os -flto -fdiagnostics-color -ffunction-sections -fdata-sections -finline-small-functions -findirect-inlining
|
||||||
|
|
||||||
|
|
||||||
# global defines ---------------------------------------------------------------
|
# global defines ---------------------------------------------------------------
|
||||||
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D LANG_$(lang) -D LANG -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U
|
GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D LANG_$(lang) -D LANG -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U
|
||||||
@@ -127,7 +125,7 @@ ifdef swd_enable
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Enable debug code generation
|
# Enable debug code generation
|
||||||
DEBUG=-g3
|
DEBUG=-g
|
||||||
# Without debug code
|
# Without debug code
|
||||||
#DEBUG=
|
#DEBUG=
|
||||||
|
|
||||||
@@ -281,14 +279,13 @@ all: $(OUT_HEXFILE).hex $(OUT_HEXFILE).bin
|
|||||||
|
|
||||||
# Create hexfile
|
# Create hexfile
|
||||||
%.hex : %.elf
|
%.hex : %.elf
|
||||||
$(SIZE) $^
|
|
||||||
$(OBJCOPY) $^ -O ihex $@
|
$(OBJCOPY) $^ -O ihex $@
|
||||||
|
|
||||||
%.bin : %.elf
|
%.bin : %.elf
|
||||||
$(SIZE) $^
|
$(SIZE) --format=berkeley $^
|
||||||
$(OBJCOPY) $^ -O binary $@
|
$(OBJCOPY) $^ -O binary $@
|
||||||
|
|
||||||
$(OUT_HEXFILE).elf : $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) Makefile $(LDSCRIPT)
|
$(OUT_HEXFILE).elf : $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) Makefile $(LDSCRIPT)
|
||||||
@test -d $(@D) || mkdir -p $(@D)
|
@test -d $(@D) || mkdir -p $(@D)
|
||||||
@echo Linking $(OUTPUT_EXE).elf
|
@echo Linking $(OUTPUT_EXE).elf
|
||||||
@echo $(LINKER_FLAGS)
|
@echo $(LINKER_FLAGS)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
#define __ASM __asm /*!< asm keyword for GNU Compiler */
|
#define __ASM __asm /*!< asm keyword for GNU Compiler */
|
||||||
#define __INLINE inline /*!< inline keyword for GNU Compiler */
|
#define __INLINE inline /*!< inline keyword for GNU Compiler */
|
||||||
#define __STATIC_INLINE static inline
|
#define __STATIC_INLINE static inline
|
||||||
|
uint32_t __get_IPSR(void);
|
||||||
// #include "cmsis_gcc.h"
|
// #include "cmsis_gcc.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user