diff --git a/drivers/bl702_driver/bl702_ram.ld b/drivers/bl702_driver/bl702_ram.ld index c458277f..00e79d9d 100644 --- a/drivers/bl702_driver/bl702_ram.ld +++ b/drivers/bl702_driver/bl702_ram.ld @@ -1,9 +1,9 @@ /**************************************************************************************** -* @file map.txt +* @file bl702_ram.ld * * @brief This file is the map file (gnuarm or armgcc). * -* Copyright (C) BouffaloLab 2018 +* Copyright (C) BouffaloLab 2021 * **************************************************************************************** */ @@ -18,7 +18,6 @@ OUTPUT_ARCH( "riscv" ) ENTRY(_enter) StackSize = 0x0400; /* 1KB */ -HeapSize = 0x1000; /* 4KB */ MEMORY { @@ -82,22 +81,6 @@ SECTIONS __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; - - /* 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 @@ -189,5 +172,10 @@ SECTIONS __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/drivers/bl702_driver/cpu_flags.cmake b/drivers/bl702_driver/cpu_flags.cmake index bc9c1e9c..484d5b28 100644 --- a/drivers/bl702_driver/cpu_flags.cmake +++ b/drivers/bl702_driver/cpu_flags.cmake @@ -7,4 +7,5 @@ list(APPEND GLOBAL_C_FLAGS -march=${MARCH} -mabi=${MABI}) list(APPEND GLOBAL_LD_FLAGS -march=${MARCH} -mabi=${MABI}) SET(LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/bl702_flash.ld) +SET(RAM_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/bl702_ram.ld) SET(BOOT2_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/blsp_boot2_iap_flash.ld) \ No newline at end of file