Skip to content

Commit 203f2cb

Browse files
committed
Adapt to more usual flags for ref_app
1 parent 63bcb12 commit 203f2cb

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

ref_app/target/app/make/app_make.gmk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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

270272
CFLAGS = $(GCCFLAGS) \
271273
$(TGT_CFLAGS) \

ref_app/target/micros/bl602_sifive_e24_riscv/Code/Appli/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
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+
6971
int main(void)
7072
{
7173
/* configure IO3 as output */

ref_app/target/micros/bl602_sifive_e24_riscv/Code/Startup/Startup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
6567
void Startup_Init(void)
6668
{
6769
/* Initialize the MCU system */

ref_app/target/micros/bl602_sifive_e24_riscv/Code/Startup/intvect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static void UndefinedHandler(void);
2727
static void UndefinedHandler(void){ for(;;); }
2828

2929
void 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));
3131
void Isr_Ext_Interrupt (void) __attribute__((weak, alias("UndefinedHandler")));
3232
void Isr_CLIC_SW_Interrupt (void) __attribute__((weak, alias("UndefinedHandler")));
3333
void 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 */

ref_app/target/micros/bl602_sifive_e24_riscv/make/bl602_sifive_e24_riscv_flags.gmk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

4949
TGT_LDFLAGS = -nostdlib \
5050
-nostartfiles \
51-
-fno-lto \
51+
-Wl,--gc-sections \
5252
-e _start \
5353
-Wl,-Map,$(APP).map \
5454
-T $(LINKER_DEFINITION_FILE)

0 commit comments

Comments
 (0)