pull/19/head
manu 2023-07-12 00:02:18 +02:00
rodzic bcebb49522
commit f5e7f35470
16 zmienionych plików z 31 dodań i 110 usunięć

Wyświetl plik

@ -11,6 +11,7 @@ target_include_directories(${NAME} PRIVATE
target_sources(${NAME} PRIVATE
system.cpp
vtable.s
)
target_link_libraries(${NAME}

Wyświetl plik

@ -10,22 +10,6 @@ extern "C" unsigned int _sidata;
extern "C" const unsigned int __org_vectors_start;
volatile static const auto *pOrgVectors = (const TVectorTable *)&__org_vectors_start;
#define ASM_VT
extern void MultiIrq_Handler(unsigned int);
#ifndef ASM_VT
template <int VectorNr> __attribute__((interrupt)) static void CommonIrqWrapper()
{
MultiIrq_Handler(VectorNr);
if (pOrgVectors->Vectors[VectorNr])
{
pOrgVectors->Vectors[VectorNr]();
}
}
#endif
void System::CopyDataSection()
{
unsigned int* sdata_ptr = &_sdata;
@ -38,8 +22,6 @@ void System::CopyDataSection()
}
}
typedef void func_ptr(void*);
void System::JumpToOrginalFw()
{
pOrgVectors->Vectors[1]();
@ -49,78 +31,3 @@ void System::JumpToOrginalVector(unsigned int u32IrqSource)
{
pOrgVectors->Vectors[u32IrqSource]();
}
#ifndef ASM_VT
TVectorTable __attribute__((section(".isr_vectors"))) VectorTable =
{
(VoidFxPointer)&_estack, //STACK PTR
(VoidFxPointer)&Reset_Handler, //RESET
&CommonIrqWrapper<2>, //NMI
&CommonIrqWrapper<3>, //hard fault or flash?
//nullptr,
nullptr, //&CommonIrqWrapper<4>,
nullptr, //&CommonIrqWrapper<5>,
nullptr, //&CommonIrqWrapper<6>,
nullptr, //&CommonIrqWrapper<7>,
nullptr, //&CommonIrqWrapper<8>,
nullptr, //&CommonIrqWrapper<9>,
nullptr, //&CommonIrqWrapper<10>,
&CommonIrqWrapper<11>, //RCC
nullptr, //&CommonIrqWrapper<12>,
nullptr, //&CommonIrqWrapper<13>,
&CommonIrqWrapper<14>, //TIM1
&CommonIrqWrapper<15>, //Reserved
&CommonIrqWrapper<16>,
&CommonIrqWrapper<17>,
&CommonIrqWrapper<18>,
&CommonIrqWrapper<19>,
&CommonIrqWrapper<20>,
&CommonIrqWrapper<21>,
&CommonIrqWrapper<22>, //TIM7
&CommonIrqWrapper<23>,
&CommonIrqWrapper<24>,
&CommonIrqWrapper<25>,
&CommonIrqWrapper<26>,
//&CommonIrqWrapper<27>, //UART0?
nullptr,
&CommonIrqWrapper<28>, //UART1?
//&CommonIrqWrapper<29>, //UART2?
nullptr,
&CommonIrqWrapper<30>,
&CommonIrqWrapper<31>,
&CommonIrqWrapper<32>,
&CommonIrqWrapper<33>,
&CommonIrqWrapper<34>,
&CommonIrqWrapper<35>,
&CommonIrqWrapper<36>,
&CommonIrqWrapper<37>,
&CommonIrqWrapper<38>,
&CommonIrqWrapper<39>,
&CommonIrqWrapper<40>,
&CommonIrqWrapper<41>,
&CommonIrqWrapper<42>,
&CommonIrqWrapper<43>,
&CommonIrqWrapper<44>,
&CommonIrqWrapper<45>,
&CommonIrqWrapper<46>,
&CommonIrqWrapper<47>,
};
#else
#endif

Wyświetl plik

@ -58,6 +58,7 @@ VectorTable:
.size VectorTable, .-VectorTable
.global VectorTable
.section .text
.extern MultiIrq_Handler

Wyświetl plik

@ -13,9 +13,9 @@ int main()
{
System::JumpToOrginalFw();
return 0;
}
}
void MultiIrq_Handler(unsigned int u32IrqSource)
extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
{
static bool bFirstInit = false;
if(!bFirstInit)
@ -30,4 +30,5 @@ void MultiIrq_Handler(unsigned int u32IrqSource)
{
Spectrum.Handle();
}
System::JumpToOrginalVector(u32IrqSource);
}

Wyświetl plik

@ -8,6 +8,8 @@ MEMORY
_estack = 0x20001388;
EXTERN(VectorTable)
SECTIONS
{
. = 0x0;

Wyświetl plik

@ -15,7 +15,7 @@ int main()
return 0;
}
void MultiIrq_Handler(unsigned int u32IrqSource)
extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
{
static bool bFirstInit = false;
if(!bFirstInit)
@ -30,4 +30,5 @@ void MultiIrq_Handler(unsigned int u32IrqSource)
{
Pong.Handle();
}
System::JumpToOrginalVector(u32IrqSource);
}

Wyświetl plik

@ -8,6 +8,8 @@ MEMORY
_estack = 0x20001388;
EXTERN(VectorTable)
SECTIONS
{
. = 0x0;

Wyświetl plik

@ -13,9 +13,9 @@ int main()
{
System::JumpToOrginalFw();
return 0;
}
}
void MultiIrq_Handler(unsigned int u32IrqSource)
extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
{
static bool bFirstInit = false;
if(!bFirstInit)

Wyświetl plik

@ -8,6 +8,8 @@ MEMORY
_estack = 0x20001388;
EXTERN(VectorTable)
SECTIONS
{
. = 0x0;

Wyświetl plik

@ -13,9 +13,9 @@ int main()
{
System::JumpToOrginalFw();
return 0;
}
}
void MultiIrq_Handler(unsigned int u32IrqSource)
extern "C" __attribute__((interrupt)) void MultiIrq_Handler(unsigned int u32IrqSource)
{
static bool bFirstInit = false;
if(!bFirstInit)
@ -30,4 +30,5 @@ void MultiIrq_Handler(unsigned int u32IrqSource)
{
CRssiPrinter::Handle(Fw, FwData);
}
System::JumpToOrginalVector(u32IrqSource);
}

Wyświetl plik

@ -8,6 +8,8 @@ MEMORY
_estack = 0x20001388;
EXTERN(VectorTable)
SECTIONS
{
. = 0x0;

Wyświetl plik

@ -5,7 +5,6 @@ add_executable(${NAME}
main.cpp
hardware/hardware.cpp
dp32g030.s
vtable.s
)
target_link_libraries(${NAME}
@ -28,7 +27,7 @@ target_compile_definitions(${NAME} PRIVATE
target_compile_options(${NAME} PRIVATE
${COMPILER_OPTIONS}
#-flto
-flto
)
target_link_options(${NAME} PRIVATE

Wyświetl plik

@ -17,17 +17,13 @@ int main() {
return 0;
}
extern "C" __attribute__((interrupt)) void MultiIrq_Handler(unsigned int u32IrqSource) {
extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
{
static bool bFirstInit = false;
if (!bFirstInit) {
System::CopyDataSection();
__libc_init_array();
//enable swd
*(unsigned int *) 0x400B000C = ((*(unsigned int *) 0x400B000C) & 0xF0FF0FFF) | 0x01001000;
*(unsigned int *) 0x400B0104 = (*(unsigned int *) 0x400B0104) | 0x4800;
bFirstInit = true;
}

Wyświetl plik

@ -8,6 +8,8 @@ MEMORY
_estack = 0x20001388;
EXTERN(VectorTable)
SECTIONS
{
. = 0x0;

Wyświetl plik

@ -15,9 +15,9 @@ int main()
{
System::JumpToOrginalFw();
return 0;
}
}
void MultiIrq_Handler(unsigned int u32IrqSource)
extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
{
unsigned int u32Dummy;
System::TCortexM0Stacking* pStackedRegs =
@ -39,4 +39,6 @@ void MultiIrq_Handler(unsigned int u32IrqSource)
{
T9Texting.Handle();
}
System::JumpToOrginalVector(u32IrqSource);
}

Wyświetl plik

@ -8,6 +8,8 @@ MEMORY
_estack = 0x20001388;
EXTERN(VectorTable)
SECTIONS
{
. = 0x0;