File tree Expand file tree Collapse file tree
micros/bl602_sifive_e24_riscv Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,7 +265,9 @@ GCCFLAGS = -g \
265265 $(WARN_FLAGS) \
266266 -Wno-comment \
267267 -gdwarf-2 \
268- -fno-exceptions
268+ -fno-exceptions \
269+ -fdata-sections \
270+ -ffunction-sections
269271
270272CFLAGS = $(GCCFLAGS) \
271273 $(TGT_CFLAGS) \
Original file line number Diff line number Diff line change 5757//-----------------------------------------------------------------------------------------
5858// Function Prototypes
5959//-----------------------------------------------------------------------------------------
60- void __attribute__((interrupt )) Isr_TIMER_Interrupt (void );
60+ void __attribute__((interrupt , used , noinline )) Isr_TIMER_Interrupt (void );
6161
6262//-----------------------------------------------------------------------------------------
6363/// \brief
@@ -66,6 +66,8 @@ void __attribute__((interrupt)) Isr_TIMER_Interrupt (void);
6666///
6767/// \return
6868//-----------------------------------------------------------------------------------------
69+ int main (void ) __attribute__((used ,noinline ));
70+
6971int main (void )
7072{
7173 /* configure IO3 as output */
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ static void Startup_InitMcuSystem(void);
5353//=========================================================================================
5454// Extern function prototype
5555//=========================================================================================
56- int main (void ) __attribute__((weak ));
56+ int main (void ) __attribute__((used , noinline ));
5757
5858//-----------------------------------------------------------------------------------------
5959/// \brief Startup_Init function
@@ -62,6 +62,8 @@ int main(void) __attribute__((weak));
6262///
6363/// \return void
6464//-----------------------------------------------------------------------------------------
65+ void Startup_Init (void ) __attribute__((used ,noinline ));
66+
6567void Startup_Init (void )
6668{
6769 /* Initialize the MCU system */
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ static void UndefinedHandler(void);
2727static void UndefinedHandler (void ){ for (;;); }
2828
2929void Isr_SW_Interrupt (void ) __attribute__((weak , alias ("UndefinedHandler" )));
30- void Isr_TIMER_Interrupt (void ) __attribute__((weak , alias ( "UndefinedHandler" ) ));
30+ void Isr_TIMER_Interrupt (void ) __attribute__((interrupt , used , noinline ));
3131void Isr_Ext_Interrupt (void ) __attribute__((weak , alias ("UndefinedHandler" )));
3232void Isr_CLIC_SW_Interrupt (void ) __attribute__((weak , alias ("UndefinedHandler" )));
3333void L1C_BMX_ERR (void ) __attribute__((weak , alias ("UndefinedHandler" )));
@@ -54,7 +54,7 @@ typedef void (*InterruptHandler)(void);
5454//=====================================================================================================
5555// Interrupt vector table
5656//=====================================================================================================
57- const InterruptHandler __attribute__((aligned (64 ))) InterruptVectorTable [] =
57+ const InterruptHandler __attribute__((aligned (64 ), section ( ".text.vivt" ) )) InterruptVectorTable [] =
5858{
5959 (InterruptHandler )& UndefinedHandler , /* IRQ 00 Reserved */
6060 (InterruptHandler )& UndefinedHandler , /* IRQ 01 Reserved */
Original file line number Diff line number Diff line change @@ -44,11 +44,11 @@ TGT_INCLUDES := -I$(PATH_TGT)/Code \
4444 -I$(PATH_TGT)/Code/StdLib/printf \
4545 -I$(PATH_TGT)/Code/StdLib
4646
47- TGT_AFLAGS = $(ARCH )
47+ TGT_AFLAGS = $(TGT_ALLFLAGS )
4848
4949TGT_LDFLAGS = -nostdlib \
5050 -nostartfiles \
51- -fno-lto \
51+ -Wl,--gc-sections \
5252 -e _start \
5353 -Wl,-Map,$(APP).map \
5454 -T $(LINKER_DEFINITION_FILE)
You can’t perform that action at this time.
0 commit comments