Skip to content

Commit

Permalink
use HEAP_D2 to side-load new patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Klang committed Mar 20, 2022
1 parent d9c7dfe commit e7618d5
Show file tree
Hide file tree
Showing 5 changed files with 769 additions and 11 deletions.
12 changes: 11 additions & 1 deletion Source/FirmwareLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,17 @@ class FirmwareLoader {
}

void allocateBuffer(size_t size){
#ifdef USE_EXTERNAL_RAM
#if defined OWL_XIBECA
extern char _HEAP_D2, _HEAP_D2_SIZE;
if(size <= (size_t)&_HEAP_D2_SIZE){
// load into spare space without stopping patch first
buffer = (uint8_t*)&_HEAP_D2;
}else{
program.exitProgram(true);
extern char _EXTRAM; // defined in link script
buffer = (uint8_t*)&_EXTRAM;
}
#elif defined USE_EXTERNAL_RAM
// stop running program and free its memory
program.exitProgram(true);
extern char _EXTRAM; // defined in link script
Expand Down
4 changes: 2 additions & 2 deletions Source/MidiHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ void MidiHandler::handleFirmwareRunCommand(uint8_t* data, uint16_t size){

void MidiHandler::runProgram(){
if(loader.isReady() && loader.setPatchSlot(0)){
program.exitProgram(true);
program.loadDynamicProgram(loader.getResourceHeader());
loader.clear();
program.startProgram(true);
// program.resetProgram(true);
program.startProgram(true);
}else{
error(PROGRAM_ERROR, "No program to run");
}
Expand Down
2 changes: 1 addition & 1 deletion XibecaDevKit/Core/Src/XibecaDevKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void onLoop(void){
#ifdef USE_FAST_POW_RESOURCES
uint32_t fast_log_table_size = 0;
uint32_t fast_pow_table_size = 0;
float fast_log_table[16384] __attribute__ ((section (".d2data")));
float fast_log_table[16384] __attribute__ ((section (".d3data")));
uint32_t fast_pow_table[2048] __attribute__ ((section (".d2data")));
void onResourceUpdate(){
Resource* res = storage.getResourceByName(SYSTEM_TABLE_LOG ".bin");
Expand Down
Loading

0 comments on commit e7618d5

Please sign in to comment.