mirror of https://github.com/wolfSSL/wolfBoot.git
app_hifive1: improved debug (app RAM moved ahead to help debugging RAM
code + optional naked version of write_page()pull/14/head
parent
b5cf09d418
commit
cfa058c411
|
@ -5,7 +5,7 @@ ENTRY( _reset )
|
|||
MEMORY
|
||||
{
|
||||
FLASH(rxai!w) : ORIGIN = 0x20020100, LENGTH = 256K - 0x100
|
||||
RAM(wxa!ri) : ORIGIN = 0x80000000, LENGTH = 16K
|
||||
RAM(wxa!ri) : ORIGIN = 0x80001000, LENGTH = 12K
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
|
|
|
@ -1,11 +1,31 @@
|
|||
#include <stdint.h>
|
||||
#include "hal.h"
|
||||
#include "target.h"
|
||||
#include "wolfboot/wolfboot.h"
|
||||
|
||||
#define PAGESIZE (0x1000) /* Flash sector: 4K */
|
||||
extern uint8_t flash_page[];
|
||||
|
||||
|
||||
#ifdef APP_DEBUG_WRITE_PAGE
|
||||
__attribute__((used,naked,section(".ramcode.user")))
|
||||
void write_page(uint32_t dst)
|
||||
{
|
||||
asm volatile ("addi sp, sp, -4");
|
||||
asm volatile ("sw ra, 0(sp)");
|
||||
if (dst == 0x60000)
|
||||
wolfBoot_erase_partition(0x01);
|
||||
hal_flash_write(dst, flash_page, PAGESIZE);
|
||||
asm volatile ("lw a4, 0(sp)");
|
||||
asm volatile ("addi sp, sp, 4");
|
||||
asm volatile ("jr a4");
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((used,section(".ramcode.user")))
|
||||
void write_page(uint32_t dst)
|
||||
{
|
||||
hal_flash_erase(dst, PAGESIZE);
|
||||
if (dst == 0x60000)
|
||||
wolfBoot_erase_partition(0x01);
|
||||
hal_flash_write(dst, flash_page, PAGESIZE);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue