Add fw_header to D0 low_load and fix the image offset with the new addresses. (#14)

This commit is contained in:
Justin Hammond 2023-03-02 16:21:36 +08:00 committed by GitHub
parent 634a27ffb4
commit e7d8799268
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View file

@ -20,6 +20,8 @@ target_sources(app PRIVATE
target_compile_options(app PRIVATE -ggdb -Os)
sdk_add_link_options(-ufw_header)
sdk_set_main_file(src/main.c)
sdk_set_linker_script(bl808_flash_d0.ld)
project(d0_lowload)

View file

@ -24,6 +24,7 @@ HeapMinSize = 0x1000; /* 4KB */
MEMORY
{
fw_header_memory (rx) : ORIGIN = 0x58000000 - 0x1000, LENGTH = 4K
xip_memory (rx) : ORIGIN = 0x58000000, LENGTH = 1M
itcm_memory (rx) : ORIGIN = 0x3F000000, LENGTH = 12K
dtcm_memory (rx) : ORIGIN = 0x3F003000, LENGTH = 4K
@ -34,7 +35,11 @@ MEMORY
SECTIONS
{
.fw_header :
{
KEEP(*(.fw_header))
} > fw_header_memory
.text :
{
. = ALIGN(4);

View file

@ -38,7 +38,7 @@ extern void unlz4(const void *aSource, void *aDestination, uint32_t FileLen);
#define VM_LINUX_DST_ADDR 0x50000000
#define OPENSBI_DST_ADDR 0x3EF80000
#define DTB_DST_ADDR 0x51ff8000
#define BOOT_HDR_SRC_ADDR 0x58080000
#define BOOT_HDR_SRC_ADDR 0x5d5ff000
static struct bflb_device_s *uart0;
@ -138,7 +138,17 @@ void linux_load()
{
LOG_I("low_load start... \r\n");
// for (int32_t i = 0; i < 10000000; i += 4) {
// vm_boot_header_t *header = (vm_boot_header_t *)BOOT_HDR_SRC_ADDR + i;
// if (header->magic == 0x4c4d5642) {
// LOG_I("Header at %d %p\r\n", i, header);
// break;
// }
// }
vm_boot_header_t *header = (vm_boot_header_t *)BOOT_HDR_SRC_ADDR;
LOG_I("Header at 0x%08x\r\n", BOOT_HDR_SRC_ADDR);
if (header->magic != 0x4c4d5642) {
LOG_E("invalid boot header magic: 0x%08x\r\n", header->magic);
return;