Skip to content

Commit

Permalink
[feat] add bl702l driver and board
Browse files Browse the repository at this point in the history
  • Loading branch information
sakumisue committed Nov 3, 2023
1 parent 10f6cb7 commit 587ac54
Show file tree
Hide file tree
Showing 60 changed files with 38,827 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bsp/board/bl702ldk/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sdk_add_include_directories(.)

target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/board.c)
target_sources(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fw_header.c)

sdk_set_linker_script(bl702l_flash.ld)

sdk_add_link_options(-ufw_header)
257 changes: 257 additions & 0 deletions bsp/board/bl702ldk/bl702l_flash.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
/****************************************************************************************
* @file bl702l_flash.ld
*
* @brief This file is the map file (gnuarm or armgcc).
*
* Copyright (C) BouffaloLab 2021
*
****************************************************************************************
*/

/* configure the CPU type */
OUTPUT_ARCH( "riscv" )

/* configure the entry point */
ENTRY(__start)

StackSize = 0x1000; /* 4KB */
HeapMinSize = 0x1000; /* 4KB */

MEMORY
{
fw_header_memory (rx) : ORIGIN = 0x23000000 - 0x1000, LENGTH = 4K
xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 1024K
itcm_memory (rx) : ORIGIN = 0x22020000, LENGTH = 16K
dtcm_memory (rx) : ORIGIN = 0x42024000, LENGTH = 4K
ram_memory (!rx) : ORIGIN = 0x42025000, LENGTH = 60K
hbn_memory (rx) : ORIGIN = 0x40010000, LENGTH = 0xE00 /* hbn ram 4K used 3.5K*/
}

SECTIONS
{
PROVIDE(__metal_chicken_bit = 0);

.fw_header :
{
KEEP(*(.fw_header))
} > fw_header_memory

.init :
{
KEEP (*(SORT_NONE(.init)))
KEEP (*(SORT_NONE(.vector)))

} > xip_memory

.text :
{
. = ALIGN(4);
__text_code_start__ = .;

*(.text)
*(.text.*)

/* section information for shell */
. = ALIGN(4);
__fsymtab_start = .;
KEEP(*(FSymTab))
__fsymtab_end = .;

. = ALIGN(4);
__vsymtab_start = .;
KEEP(*(VSymTab))
__vsymtab_end = .;

/*put .rodata**/
*(EXCLUDE_FILE( *bl702l_glb*.o* \
*bl702l_pds*.o* \
*bl702l_common*.o* \
*bl702l_sf_cfg*.o* \
*bl702l_sf_cfg_ext*.o* \
*bl702l_sf_ctrl*.o* \
*bl702l_sflash*.o* \
*bl702l_sflash_ext*.o* \
*bl702l_xip_sflash*.o* \
*bl702l_xip_sflash_ext*.o* \
*bl702l_ef_ctrl*.o*) .rodata*)

*(.srodata)
*(.srodata.*)

/* _dump_sections for bflb_coredump.c*/
. = ALIGN(4);
PROVIDE( _dump_sections = ABSOLUTE(.));
LONG(ORIGIN(itcm_memory));
LONG(LENGTH(itcm_memory));
LONG(ORIGIN(dtcm_memory));
LONG(LENGTH(dtcm_memory));
LONG(ORIGIN(ram_memory));
LONG(LENGTH(ram_memory));
LONG(ORIGIN(hbn_memory));
LONG(LENGTH(hbn_memory));
LONG(0xffffffff);
LONG(0xffffffff);
/* _dump_sections for bl_coredump.c*/

. = 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.*)

*bl702l_glb*.o*(.rodata*)
*bl702l_pds*.o*(.rodata*)
*bl702l_common*.o*(.rodata*)
*bl702l_sf_cfg*.o*(.rodata*)
*bl702l_sf_cfg_ext*.o*(.rodata*)
*bl702l_sf_ctrl*.o*(.rodata*)
*bl702l_sflash*.o*(.rodata*)
*bl702l_sflash_ext*.o*(.rodata*)
*bl702l_xip_sflash*.o*(.rodata*)
*bl702l_xip_sflash_ext*.o*(.rodata*)
*bl702l_ef_ctrl*.o*(.rodata*)

. = 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_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)
/* *finger_print.o(.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);
PROVIDE( __freertos_irq_stack_top = __StackTop);
PROVIDE( _sp_main = __StackTop);
PROVIDE( _sp_base = __StackTop - StackSize);
__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)
*(.nocache_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);
__bflog_tags_start__ = .;
*(.bflog_tags_array)
. = ALIGN(4);
__bflog_tags_end__ = .;
__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 = .;

KEEP(*(.heap*))

. = ALIGN(4);
__HeapLimit = .;
} > ram_memory

__HeapLimit = ORIGIN(ram_memory) + LENGTH(ram_memory);

ASSERT((__HeapLimit - __HeapBase ) >= HeapMinSize, "heap size is too short.")

}

Loading

0 comments on commit 587ac54

Please sign in to comment.