I have followed the steps in BootM4_from_SDRAM. The M4 will not boot from SDRAM. I have seen other posts saying they have had issues with the M4 not booting until a reset but no matter what I do, the M4 will not boot with the SDRAM bin file.
Am I missing something?
I used the following setup. It's basically unchanged from the example other than adding a print out of the first 64 bytes of the SDRAM. This data matches the bin file.
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
while (!Serial);
SDRAM.begin(0);
int err = ota_data_fs.mount(&ota_data);
if (err) {
Serial.println("Please run WiFiFirmwareUpdater once");
while (1) {
delay(10000);
}
}
//Copy M4 firmware to SDRAM
long file_size = 0;
uint8_t * boot = (uint8_t*)CM4_BINARY_START;
FILE* fw = fopen("/fs/fw.bin", "r");
if (fw == NULL) {
Serial.println("Please copy a firmware for M4 core in the PORTENTA mass storage");
Serial.println("When done, please unmount the mass storage and reset the board");
// MassStorage.begin();
while (1) {
delay(10000);
}
}else{
file_size = getFileSize(fw);
Serial.println(file_size);
}
fread((uint8_t*)CM4_BINARY_START, file_size, 1, fw);
fclose(fw);
for(int i = 0; i < 64; i++){
if(i % 16 == 0){
Serial.println("");
}
Serial.print("0x");
if(boot[i] < 16) Serial.print("0");
Serial.print(boot[i], HEX);
Serial.print(" ");
}
Serial.println(" ");
bootM4();
}
The M4 portion of the code is unchanged from the example. I exported the bin file by keeping the Flash Split: "2MB M7 + M4 in SDRAM" option, selecting the M4 as the target core, and then exporting compiled binary. I renamed this file to fw.bin, adding it to the flash.
When the arduino boots, I confirm that the data that is being printed to serial from the SDRAM matches the bin file.
I have also tried debugging via ST-Link but cannot figure out how to see the M4 registers, specifically the PC.
Spam deleted along with any replies.