[feat] update flash tool and openocd cfg

This commit is contained in:
jzlv 2021-06-04 18:00:11 +08:00
parent 0860ef4d6e
commit f3e7d8f8a4
49 changed files with 1405 additions and 648 deletions

View File

@ -153,7 +153,7 @@
<buildTargets>
<target name="bl_make" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>BOARD=bl706_iot</buildArguments>
<buildArguments>build BOARD=bl706_iot</buildArguments>
<buildTarget>APP=helloworld</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
@ -161,6 +161,7 @@
</target>
<target name="bl_clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>false</useDefaultCommand>

2
.gitignore vendored
View File

@ -2,6 +2,7 @@ out/*
build/*
.vscode/settings.json
.settings
*.pyc
**/.cdk
**/Lst
@ -9,7 +10,6 @@ build/*
examples/**/*.mk
examples/**/*.cdkws
!examples/bl_mcu_sdk.cdkws
examples/**/*.mk
examples/**/*.bat
examples/**/cdk/*.txt

View File

@ -1,10 +1,12 @@
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.15)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/tools/cmake/riscv64-unknown-elf-gcc.cmake)
include(${CMAKE_SOURCE_DIR}/tools/cmake/compiler_flags.cmake)
include(${CMAKE_SOURCE_DIR}/tools/cmake/tools.cmake)
PROJECT(${BOARD} C CXX ASM)
# set(CMAKE_VERBOSE_MAKEFILE ON)
include_directories(${CMAKE_SOURCE_DIR}/common/misc)
include_directories(${CMAKE_SOURCE_DIR}/bsp/bsp_common/platform)
@ -14,14 +16,24 @@ else()
message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/bsp/board/${BOARD} is not exist")
endif()
if(${SUPPORT_FLOAT} STREQUAL "y")
add_definitions(-DBFLB_PRINT_FLOAT_SUPPORT)
else()
endif()
if(${SUPPORT_SHELL} STREQUAL "y")
add_definitions(-DSHELL_SUPPORT)
else()
endif()
add_subdirectory(common)
add_subdirectory(components/fatfs)
add_subdirectory(components/usb_stack)
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/drivers/${mcu}_driver)
add_subdirectory(drivers/${mcu}_driver)
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/drivers/${CHIP}_driver)
add_subdirectory(drivers/${CHIP}_driver)
else()
message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/drivers/${mcu}_driver is not exist")
message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/drivers/${CHIP}_driver is not exist")
endif()
if(${SUPPORT_SHELL} STREQUAL "y")
@ -36,5 +48,16 @@ if(${SUPPORT_LVGL} STREQUAL "y")
add_subdirectory(components/lvgl)
endif()
search_application(${CMAKE_SOURCE_DIR}/examples)
if(${SUPPORT_XZ} STREQUAL "y")
add_subdirectory(components/xz)
endif()
if(${SUPPORT_BLE} STREQUAL "y")
if(${SUPPORT_FREERTOS} STREQUAL "n")
message(FATAL_ERROR "ble need freertos,so you should set SUPPORT_FREERTOS=y")
endif()
add_subdirectory(components/ble)
endif()
search_application(${CMAKE_SOURCE_DIR}/${APP_DIR})

View File

@ -1,20 +1,30 @@
BOARD?=bl706_iot
APP?=helloworld
CHIP?=bl702
INTERFACE?=jlink
BAUDRATE ?=12000
APP_DIR?=examples
APP?=helloworld
CPU_ID?=m0
SUPPORT_SHELL?=n
SUPPORT_FREERTOS?=n
SUPPORT_LVGL?=n
SUPPORT_FLOAT?=n
SUPPORT_BLE?=n
SUPPORT_XZ?=n
INTERFACE?=jlink
BAUDRATE ?=12000
export BOARD
export CHIP
export APP_DIR
export APP
export CPU_ID
export SUPPORT_SHELL
export SUPPORT_FREERTOS
export SUPPORT_LVGL
export SUPPORT_FLOAT
export SUPPORT_BLE
export SUPPORT_XZ
# The command to remove a file.
RM = cmake -E rm -rf

View File

@ -5,7 +5,7 @@
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doGdbServerAllocateConsole" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doGdbServerAllocateTelnetConsole" value="false"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doSecondReset" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doSecondReset" value="false"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doStartGdbCLient" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doStartGdbServer" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.enableSemihosting" value="false"/>
@ -16,7 +16,7 @@
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerExecutable" value="${openocd_path}/${openocd_executable}"/>
<intAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerGdbPortNumber" value="3333"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerLog" value=""/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerOther" value="-f tools\openocd\if_bflb_dbg.cfg -f tools\openocd\tgt_702.cfg"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerOther" value="-f tools\openocd\if_702_hack.cfg -f tools\openocd\tgt_702.cfg"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerTclPortNumber" value="6666"/>
<intAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerTelnetPortNumber" value="4444"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.otherInitCommands" value=""/>
@ -46,7 +46,7 @@
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="D:\BouffaloLabWS\bl_mcu_sdk\out\adc\adc_one_signle_test.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="F:\bl_mcu_sdk\out\hellowd\helloworld\helloworld_main.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="bl_mcu_sdk"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.base.528944072"/>
@ -59,4 +59,5 @@
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;Context string&quot;/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.embedcdt.debug.gdbjtag.core.PERIPHERALS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;peripherals/&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x42020000,0x42010000"/>
</launchConfiguration>

63
bl_mcu_ram.launch Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="ilg.gnumcueclipse.debug.gdbjtag.openocd.launchConfigurationType">
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doContinue" value="false"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doFirstReset" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doGdbServerAllocateConsole" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doGdbServerAllocateTelnetConsole" value="false"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doSecondReset" value="false"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doStartGdbCLient" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.doStartGdbServer" value="true"/>
<booleanAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.enableSemihosting" value="false"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.firstResetType" value="init"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbClientOtherCommands" value="set mem inaccessible-by-default off"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbClientOtherOptions" value="-x tools\openocd\702.init"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerConnectionAddress" value=""/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerExecutable" value="${openocd_path}/${openocd_executable}"/>
<intAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerGdbPortNumber" value="3333"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerLog" value=""/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerOther" value="-f tools\openocd\if_702_hack.cfg -f tools\openocd\tgt_702.cfg"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerTclPortNumber" value="6666"/>
<intAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.gdbServerTelnetPortNumber" value="4444"/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.otherInitCommands" value=""/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.otherRunCommands" value=""/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.openocd.secondResetType" value=""/>
<stringAttribute key="ilg.gnumcueclipse.debug.gdbjtag.svdPath" value="${project_loc}\drivers\bl702_driver\regs\soc702_reg.svd"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="GNU MCU OpenOCD"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value="22010000"/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${eclipse_home}\riscv64-unknown-elf-gcc-mingw32\bin\riscv64-unknown-elf-gdb.exe"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="0"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="F:\bl_mcu_sdk\out\jtag_test\jtag_test_main.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="bl_mcu_sdk"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.base.528944072"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/bl_mcu_sdk"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;Context string&quot;&gt;&#13;&#10; &lt;memoryBlockExpression address=&quot;570490880&quot; label=&quot;0x22010000&quot;/&gt;&#13;&#10;&lt;/memoryBlockExpressionList&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.embedcdt.debug.gdbjtag.core.PERIPHERALS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;peripherals/&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
<stringAttribute key="saved_expressions&lt;seperator&gt;Unknown" value="0x42000000"/>
</launchConfiguration>

View File

@ -1,4 +1,17 @@
PHONY := __build
cmake_definition+= -DCHIP=$(CHIP)
cmake_definition+= -DCPU_ID=$(CPU_ID)
cmake_definition+= -DBOARD=$(BOARD)
cmake_definition+= -DSUPPORT_FLOAT=$(SUPPORT_FLOAT)
cmake_definition+= -DSUPPORT_SHELL=$(SUPPORT_SHELL)
cmake_definition+= -DSUPPORT_FREERTOS=$(SUPPORT_FREERTOS)
cmake_definition+= -DSUPPORT_LVGL=$(SUPPORT_LVGL)
cmake_definition+= -DSUPPORT_BLE=$(SUPPORT_BLE)
cmake_definition+= -DSUPPORT_XZ=$(SUPPORT_XZ)
cmake_definition+= -DAPP_DIR=$(APP_DIR)
cmake_definition+= -DAPP=$(APP)
__build:
cmake -DBOARD=$(BOARD) -DSUPPORT_SHELL=$(SUPPORT_SHELL) -DSUPPORT_FREERTOS=$(SUPPORT_FREERTOS) -DSUPPORT_LVGL=$(SUPPORT_LVGL) -DSUPPORT_FLOAT=$(SUPPORT_FLOAT) -DAPP=$(APP) ..
make -j
cmake $(cmake_definition) ..
make -j4
.PHONY:__build

Binary file not shown.

View File

@ -0,0 +1,21 @@
build
bflb_iot_tool.exe --chipname=bl602 --xtal=40M --firmware="D:\\bouffalolab\\tool\\bflb-flash-tool\\img\\project.bin" --build
build + download
bflb_iot_tool.exe --chipname=bl602 --port=COM9 --xtal=40M --firmware="D:\\bouffalolab\\tool\\bflb-flash-tool\\img\\project.bin"
--chipname必填
--interface默认uart
--portcom口默认自动查找
--baudrate波特率默认115200
--xtalxtal
--dtsdevice tree文件
--firmware默认img目录下的project.bin
--build只生成镜像
--erase擦除flash
--single单文件烧写
--addr烧写地址默认0
--configeflash_loader_cfg.ini

Binary file not shown.

View File

@ -0,0 +1,23 @@
build
bflb_mcu_tool.exe --chipname=bl602 --xtal=40M --flashclk=48M --firmware="D:\\bouffalolab\\tool\\bflb-flash-tool\\img\\project.bin" --build
build + download
bflb_mcu_tool.exe --chipname=bl602 --port=COM9 --xtal=40M --flashclk=48M --firmware="D:\\bouffalolab\\tool\\bflb-flash-tool\\img\\project.bin"
--chipname必填
--interface默认uart
--bootsrc默认flash
--portcom口默认自动查找
--baudrate波特率默认115200
--xtalxtal
--flashclkflash clock
--pllclkpll clock
--firmware默认img目录下的project.bin
--addr烧写地址默认2000
--build只生成镜像
--erase擦除flash

View File

@ -79,5 +79,8 @@
xtal = <36 36 0 60 60>;
pwr = <14>;
};
rf_temp {
en_tcal = <0>;
};
};
};

View File

@ -79,5 +79,8 @@
xtal = <36 36 0 60 60>;
pwr = <14>;
};
rf_temp {
en_tcal = <0>;
};
};
};

View File

@ -79,5 +79,8 @@
xtal = <36 36 0 60 60>;
pwr = <14>;
};
rf_temp {
en_tcal = <0>;
};
};
};

View File

@ -0,0 +1,196 @@
[EFUSE_CFG]
########################################################################
#2bits
ef_sf_aes_mode = 0
#2bits
ef_sboot_sign_mode = 0
#2bits
ef_sboot_en = 0
#2bits
ef_dbg_jtag_dis = 0
#4bits
ef_dbg_mode = 0
#32bits
ef_dbg_pwd_low = 0
#32bits
ef_dbg_pwd_high = 0
###################################################################
ef_key_slot_2_w0 = 0
ef_key_slot_2_w1 = 0
ef_key_slot_2_w2 = 0
ef_key_slot_2_w3 = 0
ef_key_slot_3_w0 = 0
ef_key_slot_3_w1 = 0
ef_key_slot_3_w2 = 0
ef_key_slot_3_w3 = 0
ef_key_slot_4_w0 = 0
ef_key_slot_4_w1 = 0
ef_key_slot_4_w2 = 0
ef_key_slot_4_w3 = 0
wr_lock_key_slot_4_l = 0
wr_lock_dbg_pwd = 0
wr_lock_key_slot_2 = 0
wr_lock_key_slot_3 = 0
wr_lock_key_slot_4_h = 0
rd_lock_dbg_pwd = 0
rd_lock_key_slot_2 = 0
rd_lock_key_slot_3 = 0
rd_lock_key_slot_4 = 0
[BOOTHEADER_CFG]
magic_code = 0x504e4642
revision = 0x01
#########################flash cfg#############################
flashcfg_magic_code = 0x47464346
#flashcfg_magic_code=0
io_mode = 4
cont_read_support = 1
sfctrl_clk_delay = 1
sfctrl_clk_invert = 0x01
reset_en_cmd = 0x66
reset_cmd = 0x99
exit_contread_cmd = 0xff
exit_contread_cmd_size = 3
jedecid_cmd = 0x9f
jedecid_cmd_dmy_clk = 0
qpi_jedecid_cmd = 0x9f
qpi_jedecid_dmy_clk = 0
sector_size = 4
mfg_id = 0xef
page_size = 256
chip_erase_cmd = 0xc7
sector_erase_cmd = 0x20
blk32k_erase_cmd = 0x52
blk64k_erase_cmd = 0xd8
write_enable_cmd = 0x06
page_prog_cmd = 0x02
qpage_prog_cmd = 0x32
qual_page_prog_addr_mode = 0
fast_read_cmd = 0x0b
fast_read_dmy_clk = 1
qpi_fast_read_cmd = 0x0b
qpi_fast_read_dmy_clk = 1
fast_read_do_cmd = 0x3b
fast_read_do_dmy_clk = 1
fast_read_dio_cmd = 0xbb
fast_read_dio_dmy_clk = 0
fast_read_qo_cmd = 0x6b
fast_read_qo_dmy_clk = 1
fast_read_qio_cmd = 0xeb
fast_read_qio_dmy_clk = 2
qpi_fast_read_qio_cmd = 0xeb
qpi_fast_read_qio_dmy_clk = 2
qpi_page_prog_cmd = 0x02
write_vreg_enable_cmd = 0x50
wel_reg_index = 0
qe_reg_index = 1
busy_reg_index = 0
wel_bit_pos = 1
qe_bit_pos = 1
busy_bit_pos = 0
wel_reg_write_len = 2
wel_reg_read_len = 1
qe_reg_write_len = 1
qe_reg_read_len = 1
release_power_down = 0xab
busy_reg_read_len = 1
reg_read_cmd0 = 0x05
reg_read_cmd1 = 0x35
reg_write_cmd0 = 0x01
reg_write_cmd1 = 0x31
enter_qpi_cmd = 0x38
exit_qpi_cmd = 0xff
cont_read_code = 0x20
cont_read_exit_code = 0xff
burst_wrap_cmd = 0x77
burst_wrap_dmy_clk = 0x03
burst_wrap_data_mode = 2
burst_wrap_code = 0x40
de_burst_wrap_cmd = 0x77
de_burst_wrap_cmd_dmy_clk = 0x03
de_burst_wrap_code_mode = 2
de_burst_wrap_code = 0xF0
sector_erase_time = 300
blk32k_erase_time = 1200
blk64k_erase_time = 1200
page_prog_time = 5
chip_erase_time = 65535
power_down_delay = 3
qe_data = 0
flashcfg_crc32 = 0
#########################clk cfg####################################
clkcfg_magic_code = 0x47464350
#clkcfg_magic_code=0
#0:Not use XTAL to set PLL, 1:XTAL is 32M, 2:XTAL is RC32M
xtal_type = 1
#0:RC32M, 1:XTAL, 2:PLL 57.6M, 3:PLL 96M, 4:PLL 144M
pll_clk = 4
hclk_div = 0
bclk_div = 1
#0:144M, 1:XCLK(RC32M or XTAL), 2:57.6M, 3:72M, 4:BCLK, 5:96M
flash_clk_type = 3
flash_clk_div = 0
clkcfg_crc32 = 0
########################boot cfg####################################
#1:ECC
sign = 0
#1:AES128,2:AES256,3:AES192
encrypt_type = 0
key_sel = 0
no_segment = 1
cache_enable = 1
notload_in_bootrom = 0
aes_region_lock = 0
cache_way_disable = 0
crc_ignore = 0
hash_ignore = 0
boot2_enable = 0
boot2_rollback = 0
########################image cfg####################################
#total image len or segment count
img_len = 0x100
bootentry = 0
#img RAM address or flash offset
img_start = 0x2000
#img hash
hash_0 = 0xdeadbeef
hash_1 = 0
hash_2 = 0
hash_3 = 0
hash_4 = 0
hash_5 = 0
hash_6 = 0
hash_7 = 0
#address of partition tables for boot2 in bootrom
boot2_pt_table_0 = 0x1000
boot2_pt_table_1 = 0x2000
crc32 = 0xdeadbeef

View File

@ -0,0 +1,15 @@
[Img_Cfg]
boot_header_file = d:\BouffaloLabWS\bl_mcu_sdk\tools\bflb_flash_tool\chips\bl702\img_create_mcu/bootheader.bin
efuse_file = d:\BouffaloLabWS\bl_mcu_sdk\tools\bflb_flash_tool\chips\bl702\img_create_mcu/efusedata.bin
efuse_mask_file = d:\BouffaloLabWS\bl_mcu_sdk\tools\bflb_flash_tool\chips\bl702\img_create_mcu/efusedata_mask.bin
encrypt_key_org = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
aesiv_file = img_create/aesiv_cpu0.bin
publickey_file = ""
privatekey_file_uecc = ""
segheader_file = d:\BouffaloLabWS\bl_mcu_sdk\tools\bflb_flash_tool\chips\bl702\img_create_mcu/segheader_tmp.bin
segdata_file = D:/BouffaloLabWS/bl_mcu_sdk/examples/timer/timer_basic/cdk/Obj/timer_basic.bin
bootinfo_file = d:\BouffaloLabWS\bl_mcu_sdk\tools\bflb_flash_tool\chips\bl702\img_create_mcu/bootinfo.bin
img_file = d:\BouffaloLabWS\bl_mcu_sdk\tools\bflb_flash_tool\chips\bl702\img_create_mcu/img.bin
whole_img_file = d:\BouffaloLabWS\bl_mcu_sdk\tools\bflb_flash_tool\chips\bl702\img_create_mcu/img_if.bin
aes_key_org = ""
aes_iv = ""

View File

@ -11,20 +11,28 @@ del /a /f /s /q .\chips\bl702\img_create_iot\*.bin
del /a /f /s /q .\chips\bl56x\img_create_iot\*.bin
del /a /f /s /q .\chips\bl60x\img_create_iot\*.bin
del /a /f /s /q .\chips\bl606p\img_create_iot\*.bin
del /a /f /s /q .\chips\bl602u\img_create_iot\*.bin
del /a /f /s /q .\chips\bl808\img_create_iot\*.bin
del /a /f /s /q .\chips\bl602\img_create_mcu\*.bin
del /a /f /s /q .\chips\bl702\img_create_mcu\*.bin
del /a /f /s /q .\chips\bl56x\img_create_mcu\*.bin
del /a /f /s /q .\chips\bl60x\img_create_mcu\*.bin
del /a /f /s /q .\chips\bl606p\img_create_mcu\*.bin
del /a /f /s /q .\chips\bl602u\img_create_mcu\*.bin
del /a /f /s /q .\chips\bl808\img_create_mcu\*.bin
del /a /f /s /q .\chips\bl602\efuse_bootheader\*.bin
del /a /f /s /q .\chips\bl702\efuse_bootheader\*.bin
del /a /f /s /q .\chips\bl56x\efuse_bootheader\*.bin
del /a /f /s /q .\chips\bl60x\efuse_bootheader\*.bin
del /a /f /s /q .\chips\bl606p\efuse_bootheader\*.bin
del /a /f /s /q .\chips\bl602u\efuse_bootheader\*.bin
del /a /f /s /q .\chips\bl808\efuse_bootheader\*.bin
del /a /f /s /q .\chips\*.pack
rd /s /Q .\chips\bl602\ota
rd /s /Q .\chips\bl702\ota
rd /s /Q .\chips\bl56x\ota
rd /s /Q .\chips\bl60x\ota
rd /s /Q .\chips\bl606p\ota
rd /s /Q .\chips\bl602u\ota
rd /s /Q .\chips\bl808\ota
pause

View File

@ -0,0 +1,73 @@
[FLASH_CFG]
exit_contread_cmd = 0xff
exit_contread_cmd_size = 3
mfg_id = 0xeb
io_mode = 4
de_burst_wrap_cmd = 0x77
de_burst_wrap_cmd_dmy_clk = 0x03
de_burst_wrap_code_mode = 2
de_burst_wrap_code = 0xF0
write_enable_cmd = 0x06
wel_reg_index = 0
wel_bit_pos = 1
wel_reg_read_len = 1
wel_reg_write_len = 2
qe_reg_index = 1
qe_bit_pos = 1
qe_reg_write_len = 2
qe_reg_read_len = 1
busy_reg_index = 0
busy_bit_pos = 0
busy_reg_read_len = 1
release_power_down = 0xab
reg_read_cmd0 = 0x05
reg_read_cmd1 = 0x35
reg_write_cmd0 = 0x01
reg_write_cmd1 = 0x01
fast_read_qio_cmd = 0xeb
fast_read_qio_dmy_clk = 2
cont_read_support = 1
cont_read_code = 0xa0
burst_wrap_cmd = 0x77
burst_wrap_dmy_clk = 0x03
burst_wrap_data_mode = 2
burst_wrap_code = 0x40
chip_erase_cmd = 0xc7
sector_erase_cmd = 0x20
blk32k_erase_cmd = 0x52
blk64k_erase_cmd = 0xd8
page_prog_cmd = 0x02
qpage_prog_cmd = 0x32
qual_page_prog_addr_mode = 0
reset_en_cmd = 0x66
reset_cmd = 0x99
cont_read_exit_code = 0xff
jedecid_cmd = 0x9f
jedecid_cmd_dmy_clk = 0
qpi_jedecid_cmd = 0x9f
qpi_jedecid_dmy_clk = 0
sector_size = 4
page_size = 256
fast_read_cmd = 0x0b
fast_read_dmy_clk = 1
qpi_fast_read_cmd = 0x0b
qpi_fast_read_dmy_clk = 1
fast_read_do_cmd = 0x3b
fast_read_do_dmy_clk = 1
fast_read_dio_cmd = 0xbb
fast_read_dio_dmy_clk = 0
fast_read_qo_cmd = 0x6b
fast_read_qo_dmy_clk = 1
qpi_fast_read_qio_cmd = 0xeb
qpi_fast_read_qio_dmy_clk = 2
qpi_page_prog_cmd = 0x02
write_vreg_enable_cmd = 0x50
enter_qpi_cmd = 0x38
exit_qpi_cmd = 0xff
sector_erase_time = 800
blk32k_erase_time = 3000
blk64k_erase_time = 4000
page_prog_time = 10
chip_erase_time = 65535
power_down_delay = 20
qe_data = 0

View File

@ -0,0 +1,73 @@
[FLASH_CFG]
exit_contread_cmd = 0xff
exit_contread_cmd_size = 3
mfg_id = 0x5e
io_mode = 0x11
de_burst_wrap_cmd = 0x77
de_burst_wrap_cmd_dmy_clk = 0x03
de_burst_wrap_code_mode = 2
de_burst_wrap_code = 0xF0
write_enable_cmd = 0x06
wel_reg_index = 0
wel_bit_pos = 1
wel_reg_read_len = 1
wel_reg_write_len = 2
qe_reg_index = 1
qe_bit_pos = 1
qe_reg_write_len = 1
qe_reg_read_len = 1
busy_reg_index = 0
busy_bit_pos = 0
busy_reg_read_len = 1
release_power_down = 0xab
reg_read_cmd0 = 0x05
reg_read_cmd1 = 0x35
reg_write_cmd0 = 0x01
reg_write_cmd1 = 0x31
fast_read_qio_cmd = 0xeb
fast_read_qio_dmy_clk = 2
cont_read_support = 0
cont_read_code = 0x20
burst_wrap_cmd = 0x77
burst_wrap_dmy_clk = 0x03
burst_wrap_data_mode = 2
burst_wrap_code = 0x40
chip_erase_cmd = 0xc7
sector_erase_cmd = 0x20
blk32k_erase_cmd = 0x52
blk64k_erase_cmd = 0xd8
page_prog_cmd = 0x02
qpage_prog_cmd = 0x32
qual_page_prog_addr_mode = 0
reset_en_cmd = 0x66
reset_cmd = 0x99
cont_read_exit_code = 0xff
jedecid_cmd = 0x9f
jedecid_cmd_dmy_clk = 0
qpi_jedecid_cmd = 0x9f
qpi_jedecid_dmy_clk = 0
sector_size = 4
page_size = 256
fast_read_cmd = 0x0b
fast_read_dmy_clk = 1
qpi_fast_read_cmd = 0x0b
qpi_fast_read_dmy_clk = 1
fast_read_do_cmd = 0x3b
fast_read_do_dmy_clk = 1
fast_read_dio_cmd = 0xbb
fast_read_dio_dmy_clk = 0
fast_read_qo_cmd = 0x6b
fast_read_qo_dmy_clk = 1
qpi_fast_read_qio_cmd = 0xeb
qpi_fast_read_qio_dmy_clk = 2
qpi_page_prog_cmd = 0x02
write_vreg_enable_cmd = 0x50
enter_qpi_cmd = 0x38
exit_qpi_cmd = 0xff
sector_erase_time = 300
blk32k_erase_time = 1200
blk64k_erase_time = 1200
page_prog_time = 5
chip_erase_time = 33000
power_down_delay = 8
qe_data = 0

View File

@ -0,0 +1,73 @@
[FLASH_CFG]
exit_contread_cmd = 0xff
exit_contread_cmd_size = 3
mfg_id = 0x5e
io_mode = 0x11
de_burst_wrap_cmd = 0x77
de_burst_wrap_cmd_dmy_clk = 0x03
de_burst_wrap_code_mode = 2
de_burst_wrap_code = 0xF0
write_enable_cmd = 0x06
wel_reg_index = 0
wel_bit_pos = 1
wel_reg_read_len = 1
wel_reg_write_len = 2
qe_reg_index = 1
qe_bit_pos = 1
qe_reg_write_len = 1
qe_reg_read_len = 1
busy_reg_index = 0
busy_bit_pos = 0
busy_reg_read_len = 1
release_power_down = 0xab
reg_read_cmd0 = 0x05
reg_read_cmd1 = 0x35
reg_write_cmd0 = 0x01
reg_write_cmd1 = 0x31
fast_read_qio_cmd = 0xeb
fast_read_qio_dmy_clk = 2
cont_read_support = 0
cont_read_code = 0x20
burst_wrap_cmd = 0x77
burst_wrap_dmy_clk = 0x03
burst_wrap_data_mode = 2
burst_wrap_code = 0x40
chip_erase_cmd = 0xc7
sector_erase_cmd = 0x20
blk32k_erase_cmd = 0x52
blk64k_erase_cmd = 0xd8
page_prog_cmd = 0x02
qpage_prog_cmd = 0x32
qual_page_prog_addr_mode = 0
reset_en_cmd = 0x66
reset_cmd = 0x99
cont_read_exit_code = 0xff
jedecid_cmd = 0x9f
jedecid_cmd_dmy_clk = 0
qpi_jedecid_cmd = 0x9f
qpi_jedecid_dmy_clk = 0
sector_size = 4
page_size = 256
fast_read_cmd = 0x0b
fast_read_dmy_clk = 1
qpi_fast_read_cmd = 0x0b
qpi_fast_read_dmy_clk = 1
fast_read_do_cmd = 0x3b
fast_read_do_dmy_clk = 1
fast_read_dio_cmd = 0xbb
fast_read_dio_dmy_clk = 0
fast_read_qo_cmd = 0x6b
fast_read_qo_dmy_clk = 1
qpi_fast_read_qio_cmd = 0xeb
qpi_fast_read_qio_dmy_clk = 2
qpi_page_prog_cmd = 0x02
write_vreg_enable_cmd = 0x50
enter_qpi_cmd = 0x38
exit_qpi_cmd = 0xff
sector_erase_time = 300
blk32k_erase_time = 1200
blk64k_erase_time = 1200
page_prog_time = 5
chip_erase_time = 33000
power_down_delay = 8
qe_data = 0

View File

@ -0,0 +1,73 @@
[FLASH_CFG]
exit_contread_cmd = 0xff
exit_contread_cmd_size = 3
mfg_id = 0x5e
io_mode = 4
de_burst_wrap_cmd = 0x77
de_burst_wrap_cmd_dmy_clk = 0x03
de_burst_wrap_code_mode = 2
de_burst_wrap_code = 0xF0
write_enable_cmd = 0x06
wel_reg_index = 0
wel_bit_pos = 1
wel_reg_read_len = 1
wel_reg_write_len = 2
qe_reg_index = 1
qe_bit_pos = 1
qe_reg_write_len = 1
qe_reg_read_len = 1
busy_reg_index = 0
busy_bit_pos = 0
busy_reg_read_len = 1
release_power_down = 0xab
reg_read_cmd0 = 0x05
reg_read_cmd1 = 0x35
reg_write_cmd0 = 0x01
reg_write_cmd1 = 0x31
fast_read_qio_cmd = 0xeb
fast_read_qio_dmy_clk = 2
cont_read_support = 1
cont_read_code = 0x20
burst_wrap_cmd = 0x77
burst_wrap_dmy_clk = 0x03
burst_wrap_data_mode = 2
burst_wrap_code = 0x40
chip_erase_cmd = 0xc7
sector_erase_cmd = 0x20
blk32k_erase_cmd = 0x52
blk64k_erase_cmd = 0xd8
page_prog_cmd = 0x02
qpage_prog_cmd = 0x32
qual_page_prog_addr_mode = 0
reset_en_cmd = 0x66
reset_cmd = 0x99
cont_read_exit_code = 0xff
jedecid_cmd = 0x9f
jedecid_cmd_dmy_clk = 0
qpi_jedecid_cmd = 0x9f
qpi_jedecid_dmy_clk = 0
sector_size = 4
page_size = 256
fast_read_cmd = 0x0b
fast_read_dmy_clk = 1
qpi_fast_read_cmd = 0x0b
qpi_fast_read_dmy_clk = 1
fast_read_do_cmd = 0x3b
fast_read_do_dmy_clk = 1
fast_read_dio_cmd = 0xbb
fast_read_dio_dmy_clk = 0
fast_read_qo_cmd = 0x6b
fast_read_qo_dmy_clk = 1
qpi_fast_read_qio_cmd = 0xeb
qpi_fast_read_qio_dmy_clk = 2
qpi_page_prog_cmd = 0x02
write_vreg_enable_cmd = 0x50
enter_qpi_cmd = 0x38
exit_qpi_cmd = 0xff
sector_erase_time = 300
blk32k_erase_time = 1200
blk64k_erase_time = 1200
page_prog_time = 5
chip_erase_time = 33000
power_down_delay = 8
qe_data = 0

View File

@ -64,9 +64,9 @@ qpi_page_prog_cmd = 0x02
write_vreg_enable_cmd = 0x50
enter_qpi_cmd = 0x38
exit_qpi_cmd = 0xff
sector_erase_time = 300
blk32k_erase_time = 1200
blk64k_erase_time = 1200
sector_erase_time = 400
blk32k_erase_time = 1600
blk64k_erase_time = 2000
page_prog_time = 5
chip_erase_time = 65535
power_down_delay = 8

View File

@ -0,0 +1,73 @@
[FLASH_CFG]
exit_contread_cmd = 0xff
exit_contread_cmd_size = 3
mfg_id = 0x5e
io_mode = 4
de_burst_wrap_cmd = 0x77
de_burst_wrap_cmd_dmy_clk = 0x03
de_burst_wrap_code_mode = 2
de_burst_wrap_code = 0xF0
write_enable_cmd = 0x06
wel_reg_index = 0
wel_bit_pos = 1
wel_reg_read_len = 1
wel_reg_write_len = 2
qe_reg_index = 1
qe_bit_pos = 1
qe_reg_write_len = 1
qe_reg_read_len = 1
busy_reg_index = 0
busy_bit_pos = 0
busy_reg_read_len = 1
release_power_down = 0xab
reg_read_cmd0 = 0x05
reg_read_cmd1 = 0x35
reg_write_cmd0 = 0x01
reg_write_cmd1 = 0x31
fast_read_qio_cmd = 0xeb
fast_read_qio_dmy_clk = 2
cont_read_support = 1
cont_read_code = 0x20
burst_wrap_cmd = 0x77
burst_wrap_dmy_clk = 0x03
burst_wrap_data_mode = 2
burst_wrap_code = 0x40
chip_erase_cmd = 0xc7
sector_erase_cmd = 0x20
blk32k_erase_cmd = 0x52
blk64k_erase_cmd = 0xd8
page_prog_cmd = 0x02
qpage_prog_cmd = 0x32
qual_page_prog_addr_mode = 0
reset_en_cmd = 0x66
reset_cmd = 0x99
cont_read_exit_code = 0xff
jedecid_cmd = 0x9f
jedecid_cmd_dmy_clk = 0
qpi_jedecid_cmd = 0x9f
qpi_jedecid_dmy_clk = 0
sector_size = 4
page_size = 256
fast_read_cmd = 0x0b
fast_read_dmy_clk = 1
qpi_fast_read_cmd = 0x0b
qpi_fast_read_dmy_clk = 1
fast_read_do_cmd = 0x3b
fast_read_do_dmy_clk = 1
fast_read_dio_cmd = 0xbb
fast_read_dio_dmy_clk = 0
fast_read_qo_cmd = 0x6b
fast_read_qo_dmy_clk = 1
qpi_fast_read_qio_cmd = 0xeb
qpi_fast_read_qio_dmy_clk = 2
qpi_page_prog_cmd = 0x02
write_vreg_enable_cmd = 0x50
enter_qpi_cmd = 0x38
exit_qpi_cmd = 0xff
sector_erase_time = 300
blk32k_erase_time = 1200
blk64k_erase_time = 1200
page_prog_time = 5
chip_erase_time = 33000
power_down_delay = 8
qe_data = 0

Binary file not shown.

View File

@ -0,0 +1,16 @@
# BouffaloLab USB-JTAG/TTL adapter
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 0
#ftdi_tdo_sample_edge falling
transport select jtag
adapter_khz 4000
ftdi_layout_init 0x00f8 0x00fb
#ftdi_layout_signal nTRST -data 0x0400
#ftdi_layout_signal nSRST -ndata 0x0020
#reset_config srst_only srst_push_pull
#adapter_nsrst_delay 100
#adapter_nsrst_assert_width 100

View File

@ -1,100 +1,18 @@
#set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
# Object build options
# -O0 No optimizations, reduce compilation time and make debugging produce the expected results.
# -fno-builtin Do not use built-in functions provided by GCC.
# -Wall Print only standard warnings, for all use Wextra
# -ffunction-sections Place each function item into its own section in the output file.
# -fdata-sections Place each data item into its own section in the output file.
# -fomit-frame-pointer Omit the frame pointer in functions that dont need one.
# -Og Enables optimizations that do not interfere with debugging.
# -g Produce debugging information in the operating systems native format.
# -Os Optimize for size. -Os enables all -O2 optimizations.
# -flto Runs the standard link-time optimizer.
SET(MCPU "riscv-e24")
if(${SUPPORT_FLOAT} STREQUAL "y")
SET(MARCH "rv32imafc")
SET(MABI "ilp32f")
else()
SET(MARCH "rv32imac")
SET(MABI "ilp32")
endif()
SET(MCU_FLAG "-march=${MARCH} -mabi=${MABI}")
include(${CMAKE_SOURCE_DIR}/drivers/${CHIP}_driver/cpu_flags.cmake)
SET(COMMON_FLAGS "-Os -g3 -fshort-enums -fno-common \
-fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields \
-Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self \
-Wignored-qualifiers -Wunused -Wundef -msmall-data-limit=4")
# compiler: language specific flags
set(CMAKE_C_FLAGS "${MCU_FLAG} ${COMMON_FLAGS} -std=c99" CACHE INTERNAL "c compiler flags")
set(CMAKE_C_FLAGS_DEBUG "-Og -g" CACHE INTERNAL "c compiler flags: Debug")
set(CMAKE_C_FLAGS_RELEASE "-Os" CACHE INTERNAL "c compiler flags: Release")
list(APPEND GLOBAL_C_FLAGS -Os -g3)
list(APPEND GLOBAL_C_FLAGS -fshort-enums -fno-common -fms-extensions -ffunction-sections -fdata-sections -fstrict-volatile-bitfields)
list(APPEND GLOBAL_C_FLAGS -Wall -Wshift-negative-value -Wchar-subscripts -Wformat -Wuninitialized -Winit-self -Wignored-qualifiers -Wunused -Wundef)
list(APPEND GLOBAL_C_FLAGS -msmall-data-limit=4)
# message("")
# message("-----------------------------------------------------------------------------------------------------------------------------------------------------")
# message("Setting C compiler")
# message("C compiler flags options: ${CMAKE_C_FLAGS}")
# message("C compiler debug options: ${CMAKE_C_FLAGS_DEBUG}")
# message("C compiler release options: ${CMAKE_C_FLAGS_RELEASE}")
# message("-----------------------------------------------------------------------------------------------------------------------------------------------------")
list(APPEND GLOBAL_LD_FLAGS -Wl,--cref -Wl,--gc-sections -nostartfiles -g3)
list(APPEND GLOBAL_LD_FLAGS -fms-extensions -ffunction-sections -fdata-sections)
list(APPEND GLOBAL_LD_FLAGS -Wall -Wchar-subscripts -std=c99)
# Add common options
add_compile_options(${GLOBAL_C_FLAGS})
add_compile_options($<$<COMPILE_LANGUAGE:C>:-std=c99>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++11>)
add_link_options(${GLOBAL_LD_FLAGS})
set(CMAKE_CXX_FLAGS "${MCU_FLAG} ${COMMON_FLAGS} -std=c++11 " CACHE INTERNAL "cxx compiler flags")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g" CACHE INTERNAL "cxx compiler flags: Debug")
set(CMAKE_CXX_FLAGS_RELEASE "-Os" CACHE INTERNAL "cxx compiler flags: Release")
# message("")
# message("-----------------------------------------------------------------------------------------------------------------------------------------------------")
# message("Setting C++ compiler")
# message("C++ compiler flags options: ${CMAKE_CXX_FLAGS}")
# message("C++ compiler debug options: ${CMAKE_CXX_FLAGS_DEBUG}")
# message("C++ compiler release options: ${CMAKE_CXX_FLAGS_RELEASE}")
# message("-----------------------------------------------------------------------------------------------------------------------------------------------------")
set(CMAKE_ASM_FLAGS "${MCU_FLAG} ${COMMON_FLAGS}" CACHE INTERNAL "asm compiler flags")
set(CMAKE_ASM_FLAGS_DEBUG "-Og -g" CACHE INTERNAL "asm compiler flags: Debug")
set(CMAKE_ASM_FLAGS_RELEASE "-Os" CACHE INTERNAL "asm compiler flags: Release")
# message("")
# message("-----------------------------------------------------------------------------------------------------------------------------------------------------")
# message("Setting ASM compiler")
# message("ASM compiler flags options: ${CMAKE_ASM_FLAGS}")
# message("ASM compiler debug options: ${CMAKE_ASM_FLAGS_DEBUG}")
# message("ASM compiler release options: ${CMAKE_ASM_FLAGS_RELEASE}")
# message("-----------------------------------------------------------------------------------------------------------------------------------------------------")
# -Wl,--gc-sections Perform the dead code elimination.
# --specs=nano.specs Link with newlib-nano.
# --specs=nosys.specs No syscalls, provide empty implementations for the POSIX system calls.
if(${SUPPORT_FLOAT} STREQUAL "y")
add_definitions(-DBFLB_PRINT_FLOAT_SUPPORT)
else()
endif()
if(${SUPPORT_SHELL} STREQUAL "y")
add_definitions(-DSHELL_SUPPORT)
else()
endif()
if(${BOARD} MATCHES "(bl602u.*)")
set(mcu bl602u)
elseif(${BOARD} MATCHES "(bl602).*")
set(mcu bl602)
elseif(${BOARD} MATCHES "(bl702|bl704|bl706).*")
set(mcu bl702)
elseif(${BOARD} MATCHES "(bl606p).*")
set(mcu bl606p)
else()
endif()
SET(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/drivers/${mcu}_driver/${mcu}_flash.ld)
set(CMAKE_EXE_LINKER_FLAGS "${MCU_FLAG} -Wl,--cref -Wl,--gc-sections -nostartfiles -lc -lm -g3 \
-fms-extensions -ffunction-sections -fdata-sections -Wall -Wchar-subscripts \
-Wformat -Wuninitialized -Winit-self -Wignored-qualifiers -Wswitch-default -Wunused -Wundef -std=c99" CACHE INTERNAL "Linker options")

View File

@ -1,17 +1,21 @@
function(generate_library)
get_filename_component(library_name ${CMAKE_CURRENT_LIST_DIR} NAME)
message(STATUS "[register library component: ${library_name} ], path:${CMAKE_CURRENT_LIST_DIR}")
message(STATUS "[register library component: ${library_name}], path:${CMAKE_CURRENT_LIST_DIR}")
# Add src to lib
if(ADD_SRCS)
add_library(${library_name} STATIC ${ADD_SRCS})
set(include_type PUBLIC)
else()
add_library(${library_name} INTERFACE)
set(include_type INTERFACE)
foreach(f ${ADD_SRCS})
if(${f} MATCHES ".S|.s")
set_property(SOURCE ${f} PROPERTY LANGUAGE C)
endif()
endforeach()
endif()
# Add include
# Add global config include
if(ADD_INCLUDE)
foreach(include_dir ${ADD_INCLUDE})
get_filename_component(abs_dir ${include_dir} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
if(NOT IS_DIRECTORY ${abs_dir})
@ -19,79 +23,74 @@ function(generate_library)
endif()
target_include_directories(${library_name} ${include_type} ${abs_dir})
endforeach()
endif()
# Add private include
if(ADD_PRIVATE_INCLUDE)
foreach(include_dir ${ADD_PRIVATE_INCLUDE})
if(${include_type} STREQUAL INTERFACE)
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}: ADD_PRIVATE_INCLUDE set but no source file")
endif()
get_filename_component(abs_dir ${include_dir} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
if(NOT IS_DIRECTORY ${abs_dir})
message(FATAL_ERROR "${CMAKE_CURRENT_LIST_FILE}: ${include_dir} not found!")
endif()
target_include_directories(${library_name} PRIVATE ${abs_dir})
endforeach()
# Add global config include
target_include_directories(${library_name} PUBLIC ${global_config_dir})
# Add requirements
target_link_libraries(${library_name} ${ADD_REQUIREMENTS})
endif()
# Add definitions public
foreach(difinition ${ADD_DEFINITIONS})
target_compile_options(${library_name} PUBLIC ${difinition})
endforeach()
if(ADD_DEFINITIONS)
target_compile_options(${library_name} PUBLIC ${ADD_DEFINITIONS})
endif()
# Add definitions private
foreach(difinition ${ADD_DEFINITIONS_PRIVATE})
target_compile_options(${library_name} PRIVATE ${difinition})
endforeach()
if(ADD_DEFINITIONS_PRIVATE)
target_compile_options(${library_name} PRIVATE ${ADD_DEFINITIONS_PRIVATE})
endif()
# Add requirements
if(ADD_REQUIREMENTS)
foreach(lib ${ADD_REQUIREMENTS})
if(TARGET ${lib})
add_dependencies(${library_name} ${lib})
target_link_libraries(${library_name} ${lib})
else()
message(FATAL_ERROR "${lib} is not a target")
endif()
endforeach()
endif()
# Add static lib
if(ADD_STATIC_LIB)
foreach(lib ${ADD_STATIC_LIB})
if(NOT EXISTS "${lib}")
prepend(lib_full "${CMAKE_CURRENT_LIST_DIR}/" ${lib})
if(NOT EXISTS "${lib_full}")
message(FATAL_ERROR "Can not find ${lib} or ${lib_full}")
endif()
set(lib ${lib_full})
message(FATAL_ERROR "Can not find ${lib}")
endif()
target_link_libraries(${library_name} ${lib})
get_filename_component(static_lib_relative_dir ${lib} DIRECTORY)
get_filename_component(static_lib_name ${lib} NAME)
target_link_directories(${library_name} PUBLIC ${static_lib_relative_dir})
target_link_libraries(${library_name} ${static_lib_name})
endforeach()
endif()
# Add dynamic lib
if(ADD_DYNAMIC_LIB)
set(dynamic_libs ${g_dynamic_libs})
foreach(lib ${ADD_DYNAMIC_LIB})
if(NOT EXISTS "${lib}")
prepend(lib_full "${CMAKE_CURRENT_LIST_DIR}/" ${lib})
if(NOT EXISTS "${lib_full}")
message(FATAL_ERROR "Can not find ${lib} or ${lib_full}")
endif()
set(lib ${lib_full})
message(FATAL_ERROR "Can not find ${lib}")
endif()
list(APPEND dynamic_libs ${lib})
get_filename_component(lib_dir ${lib} DIRECTORY)
get_filename_component(lib_name ${lib} NAME)
target_link_libraries(${library_name} -L${lib_dir} ${lib_name})
get_filename_component(dynamic_lib_relative_dir ${lib} DIRECTORY)
get_filename_component(dynamic_lib_name ${lib} NAME)
target_link_directories(${library_name} PUBLIC ${dynamic_lib_relative_dir})
target_link_libraries(${library_name} ${dynamic_lib_name})
endforeach()
set(g_dynamic_libs ${dynamic_libs} CACHE INTERNAL "g_dynamic_libs")
endif()
endfunction()
function(generate_bin)
get_filename_component(current_relative_dir_name ${CMAKE_CURRENT_LIST_DIR} NAME)
#上面写法等价于string(REGEX REPLACE ".*/(.*)" "\\1" current_relative_dir_name ${CMAKE_CURRENT_LIST_DIR})
string(REGEX REPLACE "(.*)/${current_relative_dir_name}$" "\\1" above_absolute_dir ${CMAKE_CURRENT_LIST_DIR})
get_filename_component(above_relative_dir_name ${above_absolute_dir} NAME)
set(platform ${CMAKE_SOURCE_DIR}/bsp/bsp_common/platform/bflb_platform.c)
foreach(mainfile IN LISTS mains)
# Get file name without directory
get_filename_component(mainname ${mainfile} NAME_WE)
@ -101,31 +100,39 @@ function(generate_bin)
set(target_name firmware)
else()
if(${above_relative_dir_name} STREQUAL "examples")
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/out/${current_relative_dir_name})
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/out/${APP_DIR}/${current_relative_dir_name})
set(target_name ${current_relative_dir_name}_${mainname})
else()
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/out/${above_relative_dir_name}/${current_relative_dir_name})
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/out/${APP_DIR}/${above_relative_dir_name}/${current_relative_dir_name})
set(target_name ${current_relative_dir_name}_${mainname})
endif()
endif()
file(MAKE_DIRECTORY ${OUTPUT_DIR})
set(HEX_FILE ${OUTPUT_DIR}/main.hex)
set(BIN_FILE ${OUTPUT_DIR}/main.bin)
set(MAP_FILE ${OUTPUT_DIR}/main.map)
set(ASM_FILE ${OUTPUT_DIR}/main.asm)
set(HEX_FILE ${OUTPUT_DIR}/${target_name}.hex)
set(BIN_FILE ${OUTPUT_DIR}/${target_name}.bin)
set(MAP_FILE ${OUTPUT_DIR}/${target_name}.map)
set(ASM_FILE ${OUTPUT_DIR}/${target_name}.asm)
if(TARGET_REQUIRED_SRCS)
list(APPEND SRCS ${TARGET_REQUIRED_SRCS})
foreach(src ${TARGET_REQUIRED_SRCS})
if((NOT EXISTS ${src}) AND (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${src}))
message(FATAL_ERROR "${src} not exist,maybe you should autocomplete your path\r\n")
endif()
list(APPEND SRCS ${src})
endforeach()
endif()
list(APPEND SRCS ${CMAKE_SOURCE_DIR}/bsp/bsp_common/platform/bflb_platform.c)
list(APPEND SRCS ${CMAKE_SOURCE_DIR}/bsp/board/${BOARD}/board.c)
add_executable(${target_name}.elf ${mainfile} ${SRCS} ${platform})
add_executable(${target_name}.elf ${mainfile} ${SRCS})
set_target_properties(${target_name}.elf PROPERTIES LINK_FLAGS "-T${LINKER_SCRIPT}")
set_target_properties(${target_name}.elf PROPERTIES LINK_FLAGS "-T${LINKER_SCRIPT} -Wl,-Map=${MAP_FILE}")
set_target_properties(${target_name}.elf PROPERTIES LINK_DEPENDS ${LINKER_SCRIPT})
set_target_properties(${target_name}.elf PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}")
# Add private include
@ -138,11 +145,13 @@ function(generate_bin)
endforeach()
# Add definitions private
foreach(difinition ${TARGET_REQUIRED_PRIVATE_OPTIONS})
target_compile_options(${target_name}.elf PRIVATE ${difinition})
endforeach()
if(TARGET_REQUIRED_PRIVATE_OPTIONS)
target_compile_options(${target_name}.elf PRIVATE ${TARGET_REQUIRED_PRIVATE_OPTIONS})
endif()
add_dependencies(${target_name}.elf ${CHIP}_driver)
# Add libs
target_link_libraries(${target_name}.elf ${mcu}_driver)
target_link_libraries(${target_name}.elf ${CHIP}_driver)
if(${SUPPORT_SHELL} STREQUAL "y")
target_link_libraries(${target_name}.elf shell)
@ -154,8 +163,8 @@ function(generate_bin)
target_link_libraries(${target_name}.elf ${TARGET_REQUIRED_LIBS})
endif()
target_link_libraries(${target_name}.elf "-Wl,-Map=${MAP_FILE}")
target_link_libraries(${target_name}.elf m)
add_custom_command(TARGET ${target_name}.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${target_name}.elf> ${BIN_FILE}
COMMAND ${CMAKE_OBJDUMP} -d -S $<TARGET_FILE:${target_name}.elf> >${ASM_FILE}
@ -176,11 +185,11 @@ if(DEFINED APP)
get_filename_component(app_relative_dir ${cmakelists_file} DIRECTORY)
get_filename_component(app_name ${app_relative_dir} NAME)
if(${APP} STREQUAL "all")
message("[run app:${app_name}],path:${app_relative_dir}")
message(STATUS "[run app:${app_name}], path:${app_relative_dir}")
add_subdirectory(${app_relative_dir})
set(app_find_ok 1)
elseif(${app_name} MATCHES "^${APP}")
message("[run app:${app_name}],path:${app_relative_dir}")
message(STATUS "[run app:${app_name}], path:${app_relative_dir}")
add_subdirectory(${app_relative_dir})
set(app_find_ok 1)
endif()

View File

@ -1,15 +1,15 @@
set architecture riscv:rv32
#target remote :3333
#set disassemble-next-line on
set mem inaccessible-by-default off
#gdb_breakpoint_override [hard|soft|disable]
mem 0x22008000 0x22014000 rw
mem 0x42008000 0x42014000 rw
mem 0x22014000 0x22020000 rw
mem 0x42014000 0x42020000 rw
mem 0x22020000 0x22030000 rw
mem 0x42020000 0x42030000 rw
mem 0x22030000 0x2204C000 rw
mem 0x42030000 0x4204C000 rw
mem 0x23000000 0x23400000 ro
set architecture riscv:rv32
#target remote :3333
#set disassemble-next-line on
set mem inaccessible-by-default off
#gdb_breakpoint_override [hard|soft|disable]
mem 0x22008000 0x22014000 rw
mem 0x42008000 0x42014000 rw
mem 0x22014000 0x22020000 rw
mem 0x42014000 0x42020000 rw
mem 0x22020000 0x22030000 rw
mem 0x42020000 0x42030000 rw
mem 0x22030000 0x2204C000 rw
mem 0x42030000 0x4204C000 rw
mem 0x23000000 0x23400000 ro

View File

@ -1,236 +1,236 @@
<?xml version="1.0" encoding="utf-8"?>
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_0.xsd" >
<vendor>bouffalolab</vendor>
<vendorID>bouffalolab</vendorID>
<name>602</name>
<series>WiFi BT</series>
<version></version>
<description>high-performance, 32-bit RV32IMAFC core
</description>
<addressUnitBits>8</addressUnitBits>
<width>32</width>
<size>32</size>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
<cpu>
<name>602</name>
<endian>little</endian>
</cpu>
<peripherals>
<peripheral>
<name>CLINT</name>
<description>Core Local Interruptor.</description>
<baseAddress>0x02000000</baseAddress>
<groupName>CLINT</groupName>
<size>32</size>
<access>read-write</access>
<addressBlock>
<offset>0</offset>
<size>0x10000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<name>MSIP</name>
<description>Machine Software Interrupt Pending Register.</description>
<addressOffset>0x0000</addressOffset>
</register>
<register>
<name>MTIMECMP_LO</name>
<description>Machine Timer Compare Register Low.</description>
<addressOffset>0x4000</addressOffset>
</register>
<register>
<name>MTIMECMP_HI</name>
<description>Machine Timer Compare Register High.</description>
<addressOffset>0x4004</addressOffset>
</register>
<register>
<name>MTIME_LO</name>
<description>Machine Timer Register Low.</description>
<addressOffset>0xBFF8</addressOffset>
</register>
<register>
<name>MTIME_HI</name>
<description>Machine Timer Register High.</description>
<addressOffset>0xBFFC</addressOffset>
</register>
</registers>
</peripheral> <!-- CLINT -->
<peripheral>
<name>CLIC</name>
<description>Core Local Interrupter controller.</description>
<baseAddress>0x02800000</baseAddress>
<groupName>CLIC</groupName>
<size>8</size>
<access>read-write</access>
<addressBlock>
<offset>0</offset>
<size>0x10000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<dim>128</dim> <!-- 64 user interrupt sources o 602 -->
<dimIncrement>1</dimIncrement>
<name>PENDING[%s]</name>
<description>CLIC Interrupt Pending Registers.</description>
<addressOffset>0x0000</addressOffset>
<fields>
<field><name>PENDING</name><lsb>0</lsb><msb>0</msb></field>
</fields>
</register>
<register>
<dim>128</dim> <!-- 64 user interrupt sources o 602 -->
<dimIncrement>1</dimIncrement>
<name>ENABLE[%s]</name>
<description>CLIC Interrupt enable Registers.</description>
<addressOffset>0x0400</addressOffset>
<fields>
<field><name>ENABLE</name><lsb>0</lsb><msb>0</msb></field>
</fields>
</register>
<register>
<dim>128</dim> <!-- 64 user interrupt sources o 602 -->
<dimIncrement>1</dimIncrement>
<name>INTCFG[%s]</name>
<description>CLIC Interrupt config Registers.</description>
<addressOffset>0x0800</addressOffset>
<fields>
<field><name>INTCFG</name><lsb>3</lsb><msb>7</msb></field>
</fields>
</register>
<register>
<name>clic_cfg</name>
<description>clic_cfg.</description>
<addressOffset>0x0C00</addressOffset>
<fields>
<field><name>nvbits</name><lsb>0</lsb><msb>0</msb></field>
<field><name>nlbits</name><lsb>1</lsb><msb>3</msb></field>
<field><name>nmbits</name><lsb>4</lsb><msb>5</msb></field>
</fields>
</register>
</registers>
</peripheral> <!-- CLIC -->
<peripheral>
<name>GLB</name>
<description>GLB.</description>
<baseAddress>0x40000000</baseAddress>
<groupName>GLB</groupName>
<size>32</size>
<access>read-write</access>
<addressBlock>
<offset>0</offset>
<size>0x1000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<name>clk_cfg0</name>
<description>clk_cfg0.</description>
<addressOffset>0x0000</addressOffset>
<fields>
<field><name>pll_en</name><lsb>0</lsb><msb>0</msb></field>
<field><name>fclk_en</name><lsb>1</lsb><msb>1</msb></field>
<field><name>hclk_en</name><lsb>2</lsb><msb>2</msb></field>
<field><name>bclk_en</name><lsb>3</lsb><msb>3</msb></field>
<field><name>pll_set</name><lsb>4</lsb><msb>5</msb></field>
<field><name>hbn_root_clk_set</name><lsb>6</lsb><msb>7</msb></field>
<field><name>hclk_div</name><lsb>8</lsb><msb>15</msb></field>
<field><name>bclk_div</name><lsb>16</lsb><msb>23</msb></field>
<field><name>fclk_sw_state</name><lsb>24</lsb><msb>26</msb></field>
<field><name>chip_rdy</name><lsb>27</lsb><msb>27</msb></field>
<field><name>glb_id</name><lsb>28</lsb><msb>31</msb></field>
</fields>
</register>
</registers>
</peripheral> <!-- GLB -->
<peripheral>
<name>eFuse</name>
<description>eFuse Programmable Memory.</description>
<baseAddress>0x40007000</baseAddress>
<groupName>eFuse</groupName>
<size>32</size>
<access>read-only</access>
<addressBlock>
<offset>0</offset>
<size>0x1000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<name>ef_cfg_0</name>
<description>ef_cfg_0.</description>
<addressOffset>0x0000</addressOffset>
<fields>
<field><name>ef_sboot_en</name><lsb>4</lsb><msb>5</msb></field>
<field><name>ef_boot_sel</name><lsb>8</lsb><msb>11</msb></field>
<field><name>ef_cpu0_enc_en</name><lsb>7</lsb><msb>7</msb></field>
<field><name>ef_cpu1_enc_en</name><lsb>6</lsb><msb>6</msb></field>
<field><name>ef_sboot_en</name><lsb>4</lsb><msb>5</msb></field>
<field><name>ef_sboot_sign_mode</name><lsb>2</lsb><msb>3</msb></field>
<field><name>ef_sf_aes_mode</name><lsb>0</lsb><msb>1</msb></field>
</fields>
</register>
<register>
<name>ef_wifi_mac_low</name>
<description>ef_wifi_mac_low.</description>
<addressOffset>0x0014</addressOffset>
<fields>
<field><name>mac_addr1</name><lsb>0</lsb><msb>31</msb></field>
</fields>
</register>
<register>
<name>ef_wifi_mac_high</name>
<description>ef_wifi_mac_high.</description>
<addressOffset>0x0018</addressOffset>
<fields>
<field><name>dev_info7</name><lsb>31</lsb><msb>31</msb></field>
<field><name>dev_info6</name><lsb>30</lsb><msb>30</msb></field>
<field><name>dev_info5</name><lsb>29</lsb><msb>29</msb></field>
<field><name>dev_info4_3</name><lsb>27</lsb><msb>28</msb></field>
<field><name>dev_info2_0</name><lsb>24</lsb><msb>26</msb></field>
<field><name>cust_id1_0</name><lsb>22</lsb><msb>23</msb></field>
<field><name>mac_addr1_crc5_0</name><lsb>16</lsb><msb>21</msb></field>
<field><name>mac_addr1</name><lsb>0</lsb><msb>15</msb></field>
</fields>
</register>
</registers>
</peripheral> <!-- eFuse -->
</peripherals>
</device>
<?xml version="1.0" encoding="utf-8"?>
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD_Schema_1_0.xsd" >
<vendor>bouffalolab</vendor>
<vendorID>bouffalolab</vendorID>
<name>602</name>
<series>WiFi BT</series>
<version></version>
<description>high-performance, 32-bit RV32IMAFC core
</description>
<addressUnitBits>8</addressUnitBits>
<width>32</width>
<size>32</size>
<resetValue>0x00000000</resetValue>
<resetMask>0xFFFFFFFF</resetMask>
<cpu>
<name>602</name>
<endian>little</endian>
</cpu>
<peripherals>
<peripheral>
<name>CLINT</name>
<description>Core Local Interruptor.</description>
<baseAddress>0x02000000</baseAddress>
<groupName>CLINT</groupName>
<size>32</size>
<access>read-write</access>
<addressBlock>
<offset>0</offset>
<size>0x10000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<name>MSIP</name>
<description>Machine Software Interrupt Pending Register.</description>
<addressOffset>0x0000</addressOffset>
</register>
<register>
<name>MTIMECMP_LO</name>
<description>Machine Timer Compare Register Low.</description>
<addressOffset>0x4000</addressOffset>
</register>
<register>
<name>MTIMECMP_HI</name>
<description>Machine Timer Compare Register High.</description>
<addressOffset>0x4004</addressOffset>
</register>
<register>
<name>MTIME_LO</name>
<description>Machine Timer Register Low.</description>
<addressOffset>0xBFF8</addressOffset>
</register>
<register>
<name>MTIME_HI</name>
<description>Machine Timer Register High.</description>
<addressOffset>0xBFFC</addressOffset>
</register>
</registers>
</peripheral> <!-- CLINT -->
<peripheral>
<name>CLIC</name>
<description>Core Local Interrupter controller.</description>
<baseAddress>0x02800000</baseAddress>
<groupName>CLIC</groupName>
<size>8</size>
<access>read-write</access>
<addressBlock>
<offset>0</offset>
<size>0x10000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<dim>128</dim> <!-- 64 user interrupt sources o 602 -->
<dimIncrement>1</dimIncrement>
<name>PENDING[%s]</name>
<description>CLIC Interrupt Pending Registers.</description>
<addressOffset>0x0000</addressOffset>
<fields>
<field><name>PENDING</name><lsb>0</lsb><msb>0</msb></field>
</fields>
</register>
<register>
<dim>128</dim> <!-- 64 user interrupt sources o 602 -->
<dimIncrement>1</dimIncrement>
<name>ENABLE[%s]</name>
<description>CLIC Interrupt enable Registers.</description>
<addressOffset>0x0400</addressOffset>
<fields>
<field><name>ENABLE</name><lsb>0</lsb><msb>0</msb></field>
</fields>
</register>
<register>
<dim>128</dim> <!-- 64 user interrupt sources o 602 -->
<dimIncrement>1</dimIncrement>
<name>INTCFG[%s]</name>
<description>CLIC Interrupt config Registers.</description>
<addressOffset>0x0800</addressOffset>
<fields>
<field><name>INTCFG</name><lsb>3</lsb><msb>7</msb></field>
</fields>
</register>
<register>
<name>clic_cfg</name>
<description>clic_cfg.</description>
<addressOffset>0x0C00</addressOffset>
<fields>
<field><name>nvbits</name><lsb>0</lsb><msb>0</msb></field>
<field><name>nlbits</name><lsb>1</lsb><msb>3</msb></field>
<field><name>nmbits</name><lsb>4</lsb><msb>5</msb></field>
</fields>
</register>
</registers>
</peripheral> <!-- CLIC -->
<peripheral>
<name>GLB</name>
<description>GLB.</description>
<baseAddress>0x40000000</baseAddress>
<groupName>GLB</groupName>
<size>32</size>
<access>read-write</access>
<addressBlock>
<offset>0</offset>
<size>0x1000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<name>clk_cfg0</name>
<description>clk_cfg0.</description>
<addressOffset>0x0000</addressOffset>
<fields>
<field><name>pll_en</name><lsb>0</lsb><msb>0</msb></field>
<field><name>fclk_en</name><lsb>1</lsb><msb>1</msb></field>
<field><name>hclk_en</name><lsb>2</lsb><msb>2</msb></field>
<field><name>bclk_en</name><lsb>3</lsb><msb>3</msb></field>
<field><name>pll_set</name><lsb>4</lsb><msb>5</msb></field>
<field><name>hbn_root_clk_set</name><lsb>6</lsb><msb>7</msb></field>
<field><name>hclk_div</name><lsb>8</lsb><msb>15</msb></field>
<field><name>bclk_div</name><lsb>16</lsb><msb>23</msb></field>
<field><name>fclk_sw_state</name><lsb>24</lsb><msb>26</msb></field>
<field><name>chip_rdy</name><lsb>27</lsb><msb>27</msb></field>
<field><name>glb_id</name><lsb>28</lsb><msb>31</msb></field>
</fields>
</register>
</registers>
</peripheral> <!-- GLB -->
<peripheral>
<name>eFuse</name>
<description>eFuse Programmable Memory.</description>
<baseAddress>0x40007000</baseAddress>
<groupName>eFuse</groupName>
<size>32</size>
<access>read-only</access>
<addressBlock>
<offset>0</offset>
<size>0x1000</size>
<usage>registers</usage>
</addressBlock>
<registers>
<register>
<name>ef_cfg_0</name>
<description>ef_cfg_0.</description>
<addressOffset>0x0000</addressOffset>
<fields>
<field><name>ef_sboot_en</name><lsb>4</lsb><msb>5</msb></field>
<field><name>ef_boot_sel</name><lsb>8</lsb><msb>11</msb></field>
<field><name>ef_cpu0_enc_en</name><lsb>7</lsb><msb>7</msb></field>
<field><name>ef_cpu1_enc_en</name><lsb>6</lsb><msb>6</msb></field>
<field><name>ef_sboot_en</name><lsb>4</lsb><msb>5</msb></field>
<field><name>ef_sboot_sign_mode</name><lsb>2</lsb><msb>3</msb></field>
<field><name>ef_sf_aes_mode</name><lsb>0</lsb><msb>1</msb></field>
</fields>
</register>
<register>
<name>ef_wifi_mac_low</name>
<description>ef_wifi_mac_low.</description>
<addressOffset>0x0014</addressOffset>
<fields>
<field><name>mac_addr1</name><lsb>0</lsb><msb>31</msb></field>
</fields>
</register>
<register>
<name>ef_wifi_mac_high</name>
<description>ef_wifi_mac_high.</description>
<addressOffset>0x0018</addressOffset>
<fields>
<field><name>dev_info7</name><lsb>31</lsb><msb>31</msb></field>
<field><name>dev_info6</name><lsb>30</lsb><msb>30</msb></field>
<field><name>dev_info5</name><lsb>29</lsb><msb>29</msb></field>
<field><name>dev_info4_3</name><lsb>27</lsb><msb>28</msb></field>
<field><name>dev_info2_0</name><lsb>24</lsb><msb>26</msb></field>
<field><name>cust_id1_0</name><lsb>22</lsb><msb>23</msb></field>
<field><name>mac_addr1_crc5_0</name><lsb>16</lsb><msb>21</msb></field>
<field><name>mac_addr1</name><lsb>0</lsb><msb>15</msb></field>
</fields>
</register>
</registers>
</peripheral> <!-- eFuse -->
</peripherals>
</device>

View File

@ -1,15 +1,15 @@
set architecture riscv:rv32
#target remote :3333
#set disassemble-next-line on
set mem inaccessible-by-default off
#gdb_breakpoint_override [hard|soft|disable]
mem 0x22008000 0x22014000 rw
mem 0x42008000 0x42014000 rw
mem 0x22014000 0x22020000 rw
mem 0x42014000 0x42020000 rw
mem 0x22020000 0x22030000 rw
mem 0x42020000 0x42030000 rw
mem 0x22030000 0x2204C000 rw
mem 0x42030000 0x4204C000 rw
mem 0x23000000 0x23400000 ro
set architecture riscv:rv32
#target remote :3333
#set disassemble-next-line on
set mem inaccessible-by-default off
#gdb_breakpoint_override [hard|soft|disable]
mem 0x22008000 0x22014000 rw
mem 0x42008000 0x42014000 rw
mem 0x22014000 0x22020000 rw
mem 0x42014000 0x42020000 rw
mem 0x22020000 0x22030000 rw
mem 0x42020000 0x42030000 rw
mem 0x22030000 0x2204C000 rw
mem 0x42030000 0x4204C000 rw
mem 0x23000000 0x23400000 ro

View File

@ -0,0 +1,21 @@
# BouffaloLab USB-JTAG/TTL adapter
interface ftdi
#adapter driver ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 0
#ftdi_tdo_sample_edge falling
transport select jtag
adapter_khz 5000
#adapter speed 1000
ftdi_layout_init 0x00f8 0x00fb
#ftdi_layout_signal nTRST -data 0x0400
#ftdi_layout_signal nSRST -ndata 0x0020
#reset_config srst_only srst_push_pull
#adapter_nsrst_delay 100
#adapter_nsrst_assert_width 100
#bindto 0.0.0.0

View File

@ -1,16 +1,16 @@
# BouffaloLab USB-JTAG/TTL adapter
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 1
ftdi_tdo_sample_edge falling
transport select jtag
adapter_khz 10000
ftdi_layout_init 0x00f8 0x00fb
#ftdi_layout_signal nTRST -data 0x0400
#ftdi_layout_signal nSRST -ndata 0x0020
#reset_config srst_only srst_push_pull
#adapter_nsrst_delay 100
#adapter_nsrst_assert_width 100
# BouffaloLab USB-JTAG/TTL adapter
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 1
ftdi_tdo_sample_edge falling
transport select jtag
adapter_khz 10000
ftdi_layout_init 0x00f8 0x00fb
#ftdi_layout_signal nTRST -data 0x0400
#ftdi_layout_signal nSRST -ndata 0x0020
#reset_config srst_only srst_push_pull
#adapter_nsrst_delay 100
#adapter_nsrst_assert_width 100

View File

@ -1,16 +1,16 @@
# BouffaloLab USB-JTAG/TTL adapter
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 1
ftdi_tdo_sample_edge falling
transport select jtag
adapter_khz 30000
ftdi_layout_init 0x00f8 0x00fb
#ftdi_layout_signal nTRST -data 0x0400
#ftdi_layout_signal nSRST -ndata 0x0020
#reset_config srst_only srst_push_pull
#adapter_nsrst_delay 100
#adapter_nsrst_assert_width 100
# BouffaloLab USB-JTAG/TTL adapter
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 1
ftdi_tdo_sample_edge falling
transport select jtag
adapter_khz 30000
ftdi_layout_init 0x00f8 0x00fb
#ftdi_layout_signal nTRST -data 0x0400
#ftdi_layout_signal nSRST -ndata 0x0020
#reset_config srst_only srst_push_pull
#adapter_nsrst_delay 100
#adapter_nsrst_assert_width 100

View File

@ -1,15 +1,15 @@
# USB-JTAG/TTL based on FT2232D
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 0
transport select jtag
adapter_khz 2000
ftdi_layout_init 0x0508 0x0f2b
#ftdi_layout_signal nTRST -data 0x0400
ftdi_layout_signal nSRST -ndata 0x0020
reset_config srst_only srst_push_pull
adapter_nsrst_delay 100
adapter_nsrst_assert_width 100
# USB-JTAG/TTL based on FT2232D
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 0
transport select jtag
adapter_khz 2000
ftdi_layout_init 0x0508 0x0f2b
#ftdi_layout_signal nTRST -data 0x0400
ftdi_layout_signal nSRST -ndata 0x0020
reset_config srst_only srst_push_pull
adapter_nsrst_delay 100
adapter_nsrst_assert_width 100

View File

@ -1,7 +1,7 @@
# USB-JTAG/TTL based on FT2232D
interface jlink
transport select jtag
adapter_khz 12000
# USB-JTAG/TTL based on FT2232D
interface jlink
transport select jtag
adapter_khz 12000

View File

@ -1,40 +1,40 @@
# SiPEED USB-JTAG/TTL based on FT2232D
interface ftdi
ftdi_vid_pid 0x0403 0x6010
# http://blog.sipeed.com/p/727.html
ftdi_channel 0
transport select jtag
adapter_khz 10000
ftdi_layout_init 0x0508 0x0f1b
ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400
set _CHIPNAME riscv
#jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000001
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x0
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
#$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
#$_TARGETNAME.0 configure -work-area-phys 0x50000000 -work-area-size 32768 -work-area-backup 0
echo "SiPEED USB-JTAG/TTL Ready for Remote Connections"
proc install_bootrom {} {
# sleep 1000
init
reset init
load_image chiptest_bootrom.bin 0x21000000 bin
sleep 500
reg pc 0x21000000
# sleep 500
# bp 0x21002f0c 4 hw
# resume
}
echo "Start loading BOOTROM under project folder"
install_bootrom
echo "flash the XIP code before debugging"
echo "ONLY load symbol in GDB"
echo "use [gdb_breakpoint_override hard] for XIP debugging"
# SiPEED USB-JTAG/TTL based on FT2232D
interface ftdi
ftdi_vid_pid 0x0403 0x6010
# http://blog.sipeed.com/p/727.html
ftdi_channel 0
transport select jtag
adapter_khz 10000
ftdi_layout_init 0x0508 0x0f1b
ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400
set _CHIPNAME riscv
#jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000001
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x0
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
#$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
#$_TARGETNAME.0 configure -work-area-phys 0x50000000 -work-area-size 32768 -work-area-backup 0
echo "SiPEED USB-JTAG/TTL Ready for Remote Connections"
proc install_bootrom {} {
# sleep 1000
init
reset init
load_image chiptest_bootrom.bin 0x21000000 bin
sleep 500
reg pc 0x21000000
# sleep 500
# bp 0x21002f0c 4 hw
# resume
}
echo "Start loading BOOTROM under project folder"
install_bootrom
echo "flash the XIP code before debugging"
echo "ONLY load symbol in GDB"
echo "use [gdb_breakpoint_override hard] for XIP debugging"

View File

@ -1,24 +1,24 @@
# SiPEED USB-JTAG/TTL based on FT2232D
interface ftdi
ftdi_vid_pid 0x0403 0x6010
# http://blog.sipeed.com/p/727.html
ftdi_channel 0
transport select jtag
adapter_khz 1000
ftdi_layout_init 0x0508 0x0f1b
ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400
set _CHIPNAME riscv
#jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000001
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x0
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
#$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
#$_TARGETNAME.0 configure -work-area-phys 0x50000000 -work-area-size 32768 -work-area-backup 0
riscv set_prefer_sba on
echo "SiPEED USB-JTAG/TTL Ready for Remote Connections"
# SiPEED USB-JTAG/TTL based on FT2232D
interface ftdi
ftdi_vid_pid 0x0403 0x6010
# http://blog.sipeed.com/p/727.html
ftdi_channel 0
transport select jtag
adapter_khz 1000
ftdi_layout_init 0x0508 0x0f1b
ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400
set _CHIPNAME riscv
#jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000001
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x0
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
#$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
#$_TARGETNAME.0 configure -work-area-phys 0x50000000 -work-area-size 32768 -work-area-backup 0
riscv set_prefer_sba on
echo "SiPEED USB-JTAG/TTL Ready for Remote Connections"

View File

@ -1,45 +1,45 @@
#target chip
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000c05
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x22020000 -work-area-size 0x10000 -work-area-backup 1
#$_TARGETNAME.0 configure -rtos auto
echo "Ready for Remote Connections"
$_TARGETNAME.0 configure -event reset-assert-pre {
echo "reset-assert-pre"
adapter_khz 100
}
$_TARGETNAME.0 configure -event reset-deassert-post {
echo "reset-deassert-post"
adapter_khz 4000
reg mstatus 0x7800
reg mie 0x0
# reg pc 0x22008000
}
$_TARGETNAME.0 configure -event reset-init {
echo "reset-init"
# 4MHz for FPGA
adapter_khz 4000
}
gdb_memory_map enable
gdb_flash_program disable
riscv set_prefer_sba on
riscv set_command_timeout_sec 1
init
reset init
#jtag arp_init
#resume
#exit
#target chip
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000c05
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x22020000 -work-area-size 0x10000 -work-area-backup 1
#$_TARGETNAME.0 configure -rtos auto
echo "Ready for Remote Connections"
$_TARGETNAME.0 configure -event reset-assert-pre {
echo "reset-assert-pre"
adapter_khz 100
}
$_TARGETNAME.0 configure -event reset-deassert-post {
echo "reset-deassert-post"
adapter_khz 4000
reg mstatus 0x7800
reg mie 0x0
# reg pc 0x22008000
}
$_TARGETNAME.0 configure -event reset-init {
echo "reset-init"
# 4MHz for FPGA
adapter_khz 4000
}
gdb_memory_map enable
gdb_flash_program disable
riscv set_prefer_sba on
riscv set_command_timeout_sec 1
init
reset init
#jtag arp_init
#resume
#exit

View File

@ -1,45 +1,45 @@
#target chip
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000e05
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x22020000 -work-area-size 0x10000 -work-area-backup 1
#$_TARGETNAME.0 configure -rtos auto
echo "Ready for Remote Connections"
$_TARGETNAME.0 configure -event reset-assert-pre {
echo "reset-assert-pre"
adapter_khz 100
}
$_TARGETNAME.0 configure -event reset-deassert-post {
echo "reset-deassert-post"
adapter_khz 4000
reg mstatus 0x7800
reg mie 0x0
# reg pc 0x22008000
}
$_TARGETNAME.0 configure -event reset-init {
echo "reset-init"
# 4MHz for FPGA
adapter_khz 4000
}
gdb_memory_map enable
gdb_flash_program disable
riscv set_prefer_sba on
riscv set_command_timeout_sec 1
init
reset init
#jtag arp_init
#resume
#exit
#target chip
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000e05
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x22020000 -work-area-size 0x10000 -work-area-backup 1
#$_TARGETNAME.0 configure -rtos auto
echo "Ready for Remote Connections"
$_TARGETNAME.0 configure -event reset-assert-pre {
echo "reset-assert-pre"
adapter_khz 5000
}
$_TARGETNAME.0 configure -event reset-deassert-post {
echo "reset-deassert-post"
adapter_khz 5000
reg mstatus 0x7800
reg mie 0x0
# reg pc 0x22008000
}
$_TARGETNAME.0 configure -event reset-init {
echo "reset-init"
# 4MHz for FPGA
adapter_khz 5000
}
gdb_memory_map enable
gdb_flash_program disable
riscv set_prefer_sba on
riscv set_command_timeout_sec 1
init
reset init
#jtag arp_init
#resume
#exit

View File

@ -0,0 +1,45 @@
#target chip
set _CHIPNAME riscv
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x10000b6f
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
$_TARGETNAME.0 configure -work-area-phys 0x3eff0000 -work-area-size 0x10000 -work-area-backup 0
#$_TARGETNAME.0 configure -rtos auto
echo "Ready for Remote Connections"
$_TARGETNAME.0 configure -event reset-assert-pre {
echo "reset-assert-pre"
adapter speed 4000
}
$_TARGETNAME.0 configure -event reset-deassert-post {
echo "reset-deassert-post"
adapter speed 4000
reg mstatus 0x7800
reg mie 0x0
# reg pc 0x22008000
}
$_TARGETNAME.0 configure -event reset-init {
echo "reset-init"
# 4MHz for FPGA
adapter speed 4000
}
gdb_memory_map enable
gdb_flash_program disable
riscv set_prefer_sba off
riscv set_command_timeout_sec 1
init
#reset init
#jtag arp_init
#resume
#exit