mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[ion] Enable building with --gc-sections
Change-Id: Ibddb03d5fc95f99954583a51c02257dfcba3a326
This commit is contained in:
3
Makefile
3
Makefile
@@ -19,8 +19,7 @@ ifeq ($(DEBUG),1)
|
||||
SFLAGS += -ggdb3 -DDEBUG=1 -O0
|
||||
else
|
||||
SFLAGS += -Os -fdata-sections -ffunction-sections
|
||||
#LDFLAGS += --gc-sections
|
||||
#FIXME: --gc-sections doesn't seem to be working
|
||||
LDFLAGS += --gc-sections
|
||||
endif
|
||||
|
||||
# Language-specific flags
|
||||
|
||||
@@ -29,42 +29,9 @@ SECTIONS {
|
||||
*
|
||||
* We're generating the ISR vector table in code because it's very
|
||||
* convenient: using function pointers, we can easily point to the service
|
||||
* routine for each interrupt.
|
||||
*
|
||||
* Last but not least, instead of pointing directly to handler functions in
|
||||
* the ISR declaration, we take the opportunity of having a custom linker
|
||||
* script to use meaningful names in the ISR declaration. */
|
||||
* routine for each interrupt. */
|
||||
|
||||
PROVIDE(_ResetServiceRoutine = _start);
|
||||
PROVIDE(_NMIServiceRoutine = 0);
|
||||
PROVIDE(_HardFaultServiceRoutine = abort);
|
||||
PROVIDE(_MemManageServiceRoutine = 0);
|
||||
PROVIDE(_BusFaultServiceRoutine = 0);
|
||||
PROVIDE(_UsageFaultServiceRoutine = 0);
|
||||
PROVIDE(_SVCallServiceRoutine = 0);
|
||||
PROVIDE(_DebugMonitorServiceRoutine = 0);
|
||||
PROVIDE(_PendSVServiceRoutine = 0);
|
||||
PROVIDE(_SysTickServiceRoutine = 0);
|
||||
PROVIDE(_WWDGServiceRoutine = 0);
|
||||
PROVIDE(_PVDServiceRoutine = 0);
|
||||
PROVIDE(_TampStampServiceRoutine = 0);
|
||||
PROVIDE(_RtcWakeupServiceRoutine = 0);
|
||||
PROVIDE(_FlashServiceRoutine = 0);
|
||||
PROVIDE(_RCCServiceRoutine = 0);
|
||||
PROVIDE(_EXTI0ServiceRoutine = 0);
|
||||
PROVIDE(_EXTI1ServiceRoutine = 0);
|
||||
PROVIDE(_EXTI2ServiceRoutine = 0);
|
||||
PROVIDE(_EXTI3ServiceRoutine = 0);
|
||||
PROVIDE(_EXTI4ServiceRoutine = 0);
|
||||
PROVIDE(_DMA1Stream0ServiceRoutine = 0);
|
||||
PROVIDE(_DMA1Stream1ServiceRoutine = 0);
|
||||
PROVIDE(_DMA1Stream2ServiceRoutine = 0);
|
||||
PROVIDE(_DMA1Stream3ServiceRoutine = 0);
|
||||
PROVIDE(_DMA1Stream4ServiceRoutine = 0);
|
||||
PROVIDE(_DMA1Stream5ServiceRoutine = 0);
|
||||
PROVIDE(_DMA1Stream6ServiceRoutine = 0);
|
||||
|
||||
*(.isr_vector_table)
|
||||
KEEP(*(.isr_vector_table))
|
||||
} >FLASH
|
||||
|
||||
.text : {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "isr.h"
|
||||
|
||||
#include "rt0.h"
|
||||
extern const void * _stack_start;
|
||||
|
||||
/* Interrupt Service Routines are void->void functions */
|
||||
@@ -13,40 +12,38 @@ typedef void(*ISR)(void);
|
||||
|
||||
#define INITIALISATION_VECTOR_SIZE 0x6B
|
||||
|
||||
void _start();
|
||||
|
||||
ISR InitialisationVector[INITIALISATION_VECTOR_SIZE]
|
||||
__attribute__((section(".isr_vector_table")))
|
||||
= {
|
||||
(ISR)&_stack_start,
|
||||
_ResetServiceRoutine,
|
||||
_NMIServiceRoutine,
|
||||
_HardFaultServiceRoutine,
|
||||
_MemManageServiceRoutine,
|
||||
_BusFaultServiceRoutine,
|
||||
_UsageFaultServiceRoutine,
|
||||
(ISR)&_stack_start, // Stack start
|
||||
start, // Reset service routine,
|
||||
0, // NMI service routine,
|
||||
abort, // HardFault service routine,
|
||||
0, // MemManage service routine,
|
||||
0, // BusFault service routine,
|
||||
0, // UsageFault service routine,
|
||||
0, 0, 0, 0, // Reserved
|
||||
_SVCallServiceRoutine,
|
||||
_DebugMonitorServiceRoutine,
|
||||
0, // SVCall service routine,
|
||||
0, // DebugMonitor service routine,
|
||||
0, // Reserved
|
||||
_PendSVServiceRoutine,
|
||||
_SysTickServiceRoutine,
|
||||
_WWDGServiceRoutine,
|
||||
_PVDServiceRoutine,
|
||||
_TampStampServiceRoutine,
|
||||
_RtcWakeupServiceRoutine,
|
||||
_FlashServiceRoutine,
|
||||
_RCCServiceRoutine,
|
||||
_EXTI0ServiceRoutine,
|
||||
_EXTI1ServiceRoutine,
|
||||
_EXTI2ServiceRoutine,
|
||||
_EXTI3ServiceRoutine,
|
||||
_EXTI4ServiceRoutine,
|
||||
_DMA1Stream0ServiceRoutine,
|
||||
_DMA1Stream1ServiceRoutine,
|
||||
_DMA1Stream2ServiceRoutine,
|
||||
_DMA1Stream3ServiceRoutine,
|
||||
_DMA1Stream4ServiceRoutine,
|
||||
_DMA1Stream5ServiceRoutine,
|
||||
_DMA1Stream6ServiceRoutine
|
||||
0, // PendSV service routine,
|
||||
0, // SysTick service routine
|
||||
0, // WWDG service routine
|
||||
0, // PVD service routine
|
||||
0, // TampStamp service routine
|
||||
0, // RtcWakeup service routine
|
||||
0, // Flash service routine
|
||||
0, // RCC service routine
|
||||
0, // EXTI0 service routine
|
||||
0, // EXTI1 service routine
|
||||
0, // EXTI2 service routine
|
||||
0, // EXTI3 service routine
|
||||
0, // EXTI4 service routine
|
||||
0, // DMA1Stream0 service routine
|
||||
0, // DMA1Stream1 service routine
|
||||
0, // DMA1Stream2 service routine
|
||||
0, // DMA1Stream3 service routine
|
||||
0, // DMA1Stream4 service routine
|
||||
0, // DMA1Stream5 service routine
|
||||
0 // DMA1Stream6 service routine
|
||||
};
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
void _ResetServiceRoutine();
|
||||
void _NMIServiceRoutine();
|
||||
void _HardFaultServiceRoutine();
|
||||
void _MemManageServiceRoutine();
|
||||
void _BusFaultServiceRoutine();
|
||||
void _UsageFaultServiceRoutine();
|
||||
void _SVCallServiceRoutine();
|
||||
void _DebugMonitorServiceRoutine();
|
||||
void _PendSVServiceRoutine();
|
||||
void _SysTickServiceRoutine();
|
||||
void _WWDGServiceRoutine();
|
||||
void _PVDServiceRoutine();
|
||||
void _TampStampServiceRoutine();
|
||||
void _RtcWakeupServiceRoutine();
|
||||
void _FlashServiceRoutine();
|
||||
void _RCCServiceRoutine();
|
||||
void _EXTI0ServiceRoutine();
|
||||
void _EXTI1ServiceRoutine();
|
||||
void _EXTI2ServiceRoutine();
|
||||
void _EXTI3ServiceRoutine();
|
||||
void _EXTI4ServiceRoutine();
|
||||
void _DMA1Stream0ServiceRoutine();
|
||||
void _DMA1Stream1ServiceRoutine();
|
||||
void _DMA1Stream2ServiceRoutine();
|
||||
void _DMA1Stream3ServiceRoutine();
|
||||
void _DMA1Stream4ServiceRoutine();
|
||||
void _DMA1Stream5ServiceRoutine();
|
||||
void _DMA1Stream6ServiceRoutine();
|
||||
@@ -1,3 +1,6 @@
|
||||
extern "C" {
|
||||
#include "rt0.h"
|
||||
}
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <ion.h>
|
||||
@@ -9,11 +12,6 @@ extern char _data_section_end_ram;
|
||||
extern char _bss_section_start_ram;
|
||||
extern char _bss_section_end_ram;
|
||||
|
||||
extern "C" {
|
||||
void _start();
|
||||
void abort();
|
||||
}
|
||||
|
||||
void abort() {
|
||||
#ifdef DEBUG
|
||||
while (1) {
|
||||
@@ -23,7 +21,7 @@ void abort() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void _start() {
|
||||
void start() {
|
||||
// This is where execution starts after reset.
|
||||
// Many things are not initialized yet so the code here has to pay attention.
|
||||
|
||||
|
||||
7
ion/src/device/boot/rt0.h
Normal file
7
ion/src/device/boot/rt0.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef ION_DEVICE_BOOT_RT0_H
|
||||
#define ION_DEVICE_BOOT_RT0_H
|
||||
|
||||
void start();
|
||||
void abort();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user