From 2b658338856202ec764ccc140f6525b469be62d9 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 12 Apr 2022 19:22:54 +1000 Subject: [PATCH] Verbose boot --- .../bsp/bsp_common/platform/bflb_platform.c | 30 +-- .../drivers/bl702_driver/bl702_ram.ld | 194 ----------------- .../bl702_driver/blsp_boot2_iap_flash.ld | 196 ------------------ 3 files changed, 15 insertions(+), 405 deletions(-) delete mode 100644 source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/bl702_ram.ld delete mode 100644 source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/blsp_boot2_iap_flash.ld diff --git a/source/Core/BSP/Magic/bl_mcu_sdk/bsp/bsp_common/platform/bflb_platform.c b/source/Core/BSP/Magic/bl_mcu_sdk/bsp/bsp_common/platform/bflb_platform.c index 90f15cd0..60b42e57 100644 --- a/source/Core/BSP/Magic/bl_mcu_sdk/bsp/bsp_common/platform/bflb_platform.c +++ b/source/Core/BSP/Magic/bl_mcu_sdk/bsp/bsp_common/platform/bflb_platform.c @@ -89,23 +89,23 @@ void bflb_platform_init(uint32_t baudrate) { bl_show_info(); } + static bool initialized = false; + if (!initialized) { + // system_mmheap[0].addr = (uint8_t *)&__HeapBase; + // system_mmheap[0].mem_size = ((size_t)&__HeapLimit - (size_t)&__HeapBase); - // if (!initialized) { - // system_mmheap[0].addr = (uint8_t *)&__HeapBase; - // system_mmheap[0].mem_size = ((size_t)&__HeapLimit - (size_t)&__HeapBase); - - // if (system_mmheap[0].mem_size > 0) { - // mmheap_init(&mmheap_root, system_mmheap); - // } - - // MSG("dynamic memory init success,heap size = %d Kbyte \r\n", system_mmheap[0].mem_size / 1024); - // initialized = 1; - // if (ret != SUCCESS) { - // MSG("flash init fail!!!\r\n"); - // } - // bl_show_flashinfo(); - // } + // if (system_mmheap[0].mem_size > 0) { + // mmheap_init(&mmheap_root, system_mmheap); + // } + // MSG("dynamic memory init success,heap size = %d Kbyte \r\n", system_mmheap[0].mem_size / 1024); + initialized = 1; + if (ret != SUCCESS) { + MSG("flash init fail!!!\r\n"); + } + bl_show_flashinfo(); + } + MSG("Enable IRQ's\r\n"); cpu_global_irq_enable(); } diff --git a/source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/bl702_ram.ld b/source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/bl702_ram.ld deleted file mode 100644 index c1eabf80..00000000 --- a/source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/bl702_ram.ld +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************************** -* @file bl702_ram.ld -* -* @brief This file is the map file (gnuarm or armgcc). -* -* Copyright (C) BouffaloLab 2021 -* -**************************************************************************************** -*/ - -/* configure the CPU type */ -OUTPUT_ARCH( "riscv" ) -/* link with the standard c library */ -/* INPUT(-lc) */ -/* link with the standard GCC library */ -/* INPUT(-lgcc) */ -/* configure the entry point */ -ENTRY(_enter) - -StackSize = 0x0400; /* 1KB */ - -MEMORY -{ - itcm_memory (rx) : ORIGIN = 0x22010000, LENGTH = 32K - dtcm_memory (rx) : ORIGIN = 0x42018000, LENGTH = 32K - ram_memory (!rx) : ORIGIN = 0x42020000, LENGTH = 48K - hbn_memory (rx) : ORIGIN = 0x40010000, LENGTH = 4K /* hbn ram 4K*/ -} - -SECTIONS -{ - PROVIDE(__metal_chicken_bit = 0); - - .text : - { - . = ALIGN(4); - __text_code_start__ = .; - - KEEP (*(.text.metal.init.enter)) - KEEP (*(SORT_NONE(.init))) - - *(.text) - *(.text.*) - - *(.rodata) - *(.rodata.*) - - *(.srodata) - *(.srodata.*) - - *(.tcm_code.*) - *(.tcm_const.*) - *(.sclock_rlt_code.*) - *(.sclock_rlt_const.*) - - . = ALIGN(4); - __text_code_end__ = .; - } > itcm_memory - - . = ALIGN(4); - __itcm_load_addr = .; - - .itcm_region : AT (__itcm_load_addr) - { - . = ALIGN(4); - __tcm_code_start__ = .; - - . = ALIGN(4); - __tcm_code_end__ = .; - } > itcm_memory - - __hbn_load_addr = __itcm_load_addr + SIZEOF(.itcm_region); - - .hbn_ram_region : AT (__hbn_load_addr) - { - . = ALIGN(4); - __hbn_ram_start__ = .; - *(.hbn_ram_code) - *(.hbn_data) - . = ALIGN(4); - __hbn_ram_end__ = .; - } > hbn_memory - - __dtcm_load_addr = __hbn_load_addr + SIZEOF(.hbn_ram_region); - - .dtcm_region : AT (__dtcm_load_addr) - { - . = ALIGN(4); - __tcm_data_start__ = .; - - *(.tcm_data) - - . = ALIGN(4); - __tcm_data_end__ = .; - } > dtcm_memory - - /*************************************************************************/ - /* .stack_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of stack sections, and assign - * values to stack symbols later */ - .stack_dummy (NOLOAD): - { - . = ALIGN(0x4); - . = . + StackSize; - . = ALIGN(0x4); - } > dtcm_memory - - /* Set stack top to end of RAM, and stack limit move down by - * size of stack_dummy section */ - __StackTop = ORIGIN(dtcm_memory) + LENGTH(dtcm_memory); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__StackLimit >= __tcm_data_end__, "region RAM overflowed with stack") - /*************************************************************************/ - - __system_ram_load_addr = __dtcm_load_addr + SIZEOF(.dtcm_region); - - .system_ram_data_region : AT (__system_ram_load_addr) - { - . = ALIGN(4); - __system_ram_data_start__ = .; - - *(.system_ram) - - . = ALIGN(4); - __system_ram_data_end__ = .; - } > ram_memory - - __ram_load_addr = __system_ram_load_addr + SIZEOF(.system_ram_data_region); - - /* Data section */ - RAM_DATA : AT (__ram_load_addr) - { - . = ALIGN(4); - __ram_data_start__ = .; - - PROVIDE( __global_pointer$ = . + 0x800 ); - - *(.data) - *(.data.*) - *(.sdata) - *(.sdata.*) - *(.sdata2) - *(.sdata2.*) - - . = ALIGN(4); - __ram_data_end__ = .; - } > ram_memory - - .bss (NOLOAD) : - { - . = ALIGN(4); - __bss_start__ = .; - - *(.bss*) - *(.sbss*) - *(COMMON) - - . = ALIGN(4); - __bss_end__ = .; - } > ram_memory - - .noinit_data (NOLOAD) : - { - . = ALIGN(4); - __noinit_data_start__ = .; - - *(.noinit_data*) - - . = ALIGN(4); - __noinit_data_end__ = .; - } > ram_memory - - .heap (NOLOAD): - { - . = ALIGN(4); - __HeapBase = .; - - /*__end__ = .;*/ - /*end = __end__;*/ - KEEP(*(.heap*)) - - . = ALIGN(4); - __HeapLimit = .; - } > ram_memory - - PROVIDE (__heap_min_size = 0x400); - __HeapLimit = ORIGIN(ram_memory) + LENGTH(ram_memory); - - ASSERT((__HeapLimit - __HeapBase ) >= __heap_min_size, "heap size is too short.") - -} - diff --git a/source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/blsp_boot2_iap_flash.ld b/source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/blsp_boot2_iap_flash.ld deleted file mode 100644 index d44754d0..00000000 --- a/source/Core/BSP/Magic/bl_mcu_sdk/drivers/bl702_driver/blsp_boot2_iap_flash.ld +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************************** -* @file map.txt -* -* @brief This file is the map file (gnuarm or armgcc). -* -* Copyright (C) BouffaloLab 2018 -* -**************************************************************************************** -*/ - -/* configure the CPU type */ -OUTPUT_ARCH( "riscv" ) -/* link with the standard c library */ -INPUT(-lc) -/* link with the standard GCC library */ -INPUT(-lgcc) -/* configure the entry point */ -ENTRY(_enter) - -StackSize = 0x1000; /* 4KB */ -HeapSize = 0x0; /* 0KB */ -PROVIDE(__boot2_pass_param_addr = 0x4202DC00); - -MEMORY -{ - xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 64K - itcm_memory (rx) : ORIGIN = 0x22014000, LENGTH = 16K - dtcm_memory (rx) : ORIGIN = 0x42018000, LENGTH = 4K - ram_memory (!rx) : ORIGIN = 0x42019000/*0x42020000*/, LENGTH = 88K -} - -SECTIONS -{ - PROVIDE(__metal_chicken_bit = 0); - - .text : - { - . = ALIGN(4); - __text_code_start__ = .; - - KEEP (*(.text.metal.init.enter)) - KEEP (*(SORT_NONE(.init))) - - /* section information for usb desc */ - . = ALIGN(4); - _usb_desc_start = .; - KEEP(*(usb_desc)) - . = ALIGN(4); - _usb_desc_end = .; - - *(EXCLUDE_FILE ( *bl702_uart*.o* *hal_uart*.o* ) .text*) - - *(.rodata) - *(.rodata.*) - *(.srodata) - *(.srodata.*) - - . = ALIGN(4); - __text_code_end__ = .; - } > xip_memory - - . = ALIGN(4); - __itcm_load_addr = .; - - .itcm_region : AT (__itcm_load_addr) - { - . = ALIGN(4); - __tcm_code_start__ = .; - *(.tcm_code.*) - *(.tcm_const.*) - *(.sclock_rlt_code.*) - *(.sclock_rlt_const.*) - *bl702_romapi*.o*(.text) - *bl702_romapi*.o*(.text.*) - *bl702_romapi*.o*(.rodata) - *bl702_romapi*.o*(.rodata.*) - *bl702_romapi*.o*(.srodata) - *bl702_romapi*.o*(.srodata.*) - *bl702_uart*.o* (.text*) - *hal_uart*.o* (.text*) - . = ALIGN(4); - __tcm_code_end__ = .; - - } > itcm_memory - - __dtcm_load_addr = __itcm_load_addr + SIZEOF(.itcm_region); - - .dtcm_region : AT (__dtcm_load_addr) - { - . = ALIGN(4); - __tcm_data_start__ = .; - - *(.tcm_data) - /* *finger_print.o(.data*) */ - - . = ALIGN(4); - __tcm_data_end__ = .; - } > dtcm_memory - - /* .heap_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of heap sections, and assign - * values to heap symbols later */ - .heap_dummy (NOLOAD): - { - . = ALIGN(0x4); - . = . + HeapSize; - . = ALIGN(0x4); - } > dtcm_memory - - __HeapBase = ORIGIN(dtcm_memory) + LENGTH(dtcm_memory) - StackSize - HeapSize; - __HeapSize = HeapSize; - __HeapLimit = __HeapBase + __HeapSize; - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__HeapBase >= __tcm_data_end__, "region RAM overflowed with stack") - - /*************************************************************************/ - /* .stack_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of stack sections, and assign - * values to stack symbols later */ - .stack_dummy (NOLOAD): - { - . = ALIGN(0x4); - . = . + StackSize; - . = ALIGN(0x4); - } > dtcm_memory - - /* Set stack top to end of RAM, and stack limit move down by - * size of stack_dummy section */ - __StackTop = ORIGIN(dtcm_memory) + LENGTH(dtcm_memory); - __StackLimit = __StackTop - SIZEOF(.stack_dummy); - - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__StackLimit >= __tcm_data_end__, "region RAM overflowed with stack") - /*************************************************************************/ - - __system_ram_load_addr = __dtcm_load_addr + SIZEOF(.dtcm_region); - - .system_ram_data_region : AT (__system_ram_load_addr) - { - . = ALIGN(4); - __system_ram_data_start__ = .; - - *(.system_ram) - - . = ALIGN(4); - __system_ram_data_end__ = .; - } > ram_memory - - __ram_load_addr = __system_ram_load_addr + SIZEOF(.system_ram_data_region); - - /* Data section */ - RAM_DATA : AT (__ram_load_addr) - { - . = ALIGN(4); - __ram_data_start__ = .; - - PROVIDE( __global_pointer$ = . + 0x800 ); - - *(.data) - *(.data.*) - *(.sdata) - *(.sdata.*) - *(.sdata2) - *(.sdata2.*) - - . = ALIGN(4); - __ram_data_end__ = .; - } > ram_memory - - .bss (NOLOAD) : - { - . = ALIGN(4); - __bss_start__ = .; - - *(.bss*) - *(.sbss*) - *(COMMON) - - . = ALIGN(4); - __bss_end__ = .; - } > ram_memory - - .noinit_data (NOLOAD) : - { - . = ALIGN(4); - __noinit_data_start__ = .; - - *(.noinit_data*) - - . = ALIGN(4); - __noinit_data_end__ = .; - } > ram_memory - - -} -