kopia lustrzana https://github.com/piotr022/UV_K5_playground
prepare for PR
rodzic
f5e7f35470
commit
2afe4cbf5b
|
@ -32,8 +32,8 @@ namespace System
|
|||
};
|
||||
|
||||
void JumpToOrginalFw();
|
||||
void JumpToOrginalVector(unsigned int u32IrqSource);
|
||||
void CopyDataSection();
|
||||
void JumpToOrginalVector(unsigned int u32IrqSource);
|
||||
void CopyDataSection();
|
||||
|
||||
struct TOrgFunctions
|
||||
{
|
||||
|
|
|
@ -30,4 +30,5 @@ extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
|
|||
{
|
||||
CRssiPrinter::Handle(Fw, FwData);
|
||||
}
|
||||
System::JumpToOrginalVector(u32IrqSource);
|
||||
}
|
|
@ -15,7 +15,7 @@ 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)
|
||||
|
|
|
@ -2,10 +2,10 @@ set(NAME spectrum)
|
|||
set(MCU_TARGET_FILES_DIR ../mcu_target_common)
|
||||
|
||||
add_executable(${NAME}
|
||||
main.cpp
|
||||
hardware/hardware.cpp
|
||||
dp32g030.s
|
||||
)
|
||||
main.cpp
|
||||
hardware/hardware.cpp
|
||||
dp32g030.s
|
||||
)
|
||||
|
||||
target_link_libraries(${NAME}
|
||||
orginal_fw
|
||||
|
@ -33,6 +33,7 @@ target_compile_options(${NAME} PRIVATE
|
|||
target_link_options(${NAME} PRIVATE
|
||||
#-print-multi-lib
|
||||
-T ${CMAKE_CURRENT_SOURCE_DIR}/memory.ld
|
||||
-flto
|
||||
-mcpu=cortex-m0
|
||||
-mthumb
|
||||
-mfpu=auto
|
||||
|
@ -68,7 +69,7 @@ add_custom_command(TARGET ${NAME}
|
|||
)
|
||||
|
||||
add_custom_target(${NAME}_flash
|
||||
COMMAND openocd -f interface/cmsis-dap.cfg -f ${PROJECT_SOURCE_DIR}/openocd_scripts/dp32g030.cfg -c "write_image ${PROJECT_SOURCE_DIR}/cmake-build-debug/src/spectrum/spectrum.bin 0x1000" -c "halt" -c "shutdown"
|
||||
COMMAND openocd -f interface/cmsis-dap.cfg -f ${PROJECT_SOURCE_DIR}/openocd_scripts/dp32g030.cfg -c "write_image ${PROJECT_SOURCE_DIR}/build/src/rssi_printer/rssi_printer.bin 0x1000" -c "halt" -c "shutdown"
|
||||
DEPENDS ${NAME}
|
||||
)
|
||||
|
||||
|
|
|
@ -6,38 +6,38 @@
|
|||
#include <string.h>
|
||||
|
||||
Hardware::THardware Hw;
|
||||
const System::TOrgFunctions &Fw = System::OrgFunc_01_26;
|
||||
const System::TOrgData &FwData = System::OrgData_01_26;
|
||||
const System::TOrgFunctions& Fw = System::OrgFunc_01_26;
|
||||
const System::TOrgData& FwData = System::OrgData_01_26;
|
||||
|
||||
CSpectrum<System::OrgFunc_01_26, System::OrgData_01_26> Spectrum;
|
||||
|
||||
|
||||
int main() {
|
||||
System::JumpToOrginalFw();
|
||||
return 0;
|
||||
int main()
|
||||
{
|
||||
System::JumpToOrginalFw();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
|
||||
{
|
||||
unsigned int u32Dummy;
|
||||
System::TCortexM0Stacking* pStackedRegs =
|
||||
(System::TCortexM0Stacking*)(((unsigned int*)&u32Dummy) + 1);
|
||||
|
||||
static bool bFirstInit = false;
|
||||
if (!bFirstInit) {
|
||||
System::CopyDataSection();
|
||||
__libc_init_array();
|
||||
bFirstInit = true;
|
||||
}
|
||||
static bool bFirstInit = false;
|
||||
if(!bFirstInit)
|
||||
{
|
||||
System::CopyDataSection();
|
||||
__libc_init_array();
|
||||
bFirstInit = true;
|
||||
}
|
||||
|
||||
unsigned int u32Dummy;
|
||||
System::TCortexM0Stacking *pStackedRegs =
|
||||
(System::TCortexM0Stacking *) (((unsigned int *) &u32Dummy) + 1);
|
||||
bool bPreventWhileKeypadPolling = pStackedRegs->LR > (unsigned int)Fw.PollKeyboard &&
|
||||
pStackedRegs->PC < (unsigned int)Fw.PollKeyboard + 0x100; // i made a mistake and compared PC and LR, but this works fine xD
|
||||
|
||||
bool bPreventWhileKeypadPolling = pStackedRegs->LR > (unsigned int) Fw.PollKeyboard &&
|
||||
pStackedRegs->PC < (unsigned int) Fw.PollKeyboard +
|
||||
0x100; // i made a mistake and compared PC and LR, but this works fine xD
|
||||
|
||||
static unsigned int u32StupidCounter = 1;
|
||||
if (u32StupidCounter++ > 200 && !bPreventWhileKeypadPolling) {
|
||||
Spectrum.Handle();
|
||||
}
|
||||
static unsigned int u32StupidCounter = 1;
|
||||
if(u32StupidCounter++ > 200 && !bPreventWhileKeypadPolling)
|
||||
{
|
||||
Spectrum.Handle();
|
||||
}
|
||||
System::JumpToOrginalVector(u32IrqSource);
|
||||
}
|
|
@ -39,6 +39,5 @@ extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
|
|||
{
|
||||
T9Texting.Handle();
|
||||
}
|
||||
|
||||
System::JumpToOrginalVector(u32IrqSource);
|
||||
}
|
Ładowanie…
Reference in New Issue