mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-08 13:58:35 +00:00
[fix][examples] modify some demos peripheral init parameters,update ld file
This commit is contained in:
parent
ee03cdc86e
commit
48479d0e20
33 changed files with 544 additions and 626 deletions
|
@ -60,14 +60,18 @@ SECTIONS
|
||||||
*(.text.*)
|
*(.text.*)
|
||||||
|
|
||||||
/*put .rodata**/
|
/*put .rodata**/
|
||||||
*(EXCLUDE_FILE( *bl702_glb.o \
|
*(EXCLUDE_FILE( *bl702_glb*.o* \
|
||||||
*bl702_pds.o \
|
*bl702_pds*.o* \
|
||||||
*bl702_common.o \
|
*bl702_common*.o* \
|
||||||
*bl702_sf_cfg.o \
|
*bl702_sf_cfg*.o* \
|
||||||
*bl702_sf_ctrl.o \
|
*bl702_sf_cfg_ext*.o* \
|
||||||
*bl702_sflash.o \
|
*bl702_sf_ctrl*.o* \
|
||||||
*bl702_xip_sflash.o \
|
*bl702_sflash*.o* \
|
||||||
*bl702_ef_ctrl.o) .rodata*)
|
*bl702_sflash_ext*.o* \
|
||||||
|
*bl702_xip_sflash*.o* \
|
||||||
|
*bl702_xip_sflash_ext*.o* \
|
||||||
|
*bl702_ef_ctrl*.o*) .rodata*)
|
||||||
|
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
|
|
||||||
|
@ -86,19 +90,22 @@ SECTIONS
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_start__ = .;
|
__tcm_code_start__ = .;
|
||||||
|
|
||||||
*(.tcm_code)
|
*(.tcm_code.*)
|
||||||
*(.tcm_const)
|
*(.tcm_const.*)
|
||||||
*(.sclock_rlt_code)
|
*(.sclock_rlt_code.*)
|
||||||
*(.sclock_rlt_const)
|
*(.sclock_rlt_const.*)
|
||||||
|
|
||||||
*bl702_glb.o*(.rodata*)
|
*bl702_glb*.o*(.rodata*)
|
||||||
*bl702_pds.o*(.rodata*)
|
*bl702_pds*.o*(.rodata*)
|
||||||
*bl702_common.o*(.rodata*)
|
*bl702_common*.o*(.rodata*)
|
||||||
*bl702_sf_cfg.o*(.rodata*)
|
*bl702_sf_cfg*.o*(.rodata*)
|
||||||
*bl702_sf_ctrl.o*(.rodata*)
|
*bl702_sf_cfg_ext*.o*(.rodata*)
|
||||||
*bl702_sflash.o*(.rodata*)
|
*bl702_sf_ctrl*.o*(.rodata*)
|
||||||
*bl702_xip_sflash.o*(.rodata*)
|
*bl702_sflash*.o*(.rodata*)
|
||||||
*bl702_ef_ctrl.o*(.rodata*)
|
*bl702_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_ef_ctrl*.o*(.rodata*)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_end__ = .;
|
__tcm_code_end__ = .;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Project Name="flash_rw_test" Version="1" Language="C">
|
<Project Name="flash_read_write" Version="1" Language="C">
|
||||||
<Description>CPU: RV32IMAFC
|
<Description>CPU: RV32IMAFC
|
||||||
Chip: bl70x
|
Chip: bl70x
|
||||||
Board: bl70x_iot
|
Board: bl70x_iot
|
||||||
|
@ -29,15 +29,36 @@ Board: bl70x_iot
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<VirtualDirectory Name="hal">
|
<VirtualDirectory Name="hal">
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_acomp.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_adc.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_adc.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_boot2.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_cam.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_clock.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_common.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dac.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dac.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dma.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_dma.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_emac.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_flash.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_gpio.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_gpio.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
@ -47,12 +68,39 @@ Board: bl70x_iot
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2s.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_i2s.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_keyscan.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mjpeg.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mtimer.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mtimer.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pm.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pwm.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pwm.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_qdec.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_rtc.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_sec_aes.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_sec_dsa.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_sec_ecdsa.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_sec_hash.c">
|
||||||
|
<FileOption/>
|
||||||
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_spi.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_spi.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
@ -65,19 +113,7 @@ Board: bl70x_iot
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_usb.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_usb.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_clock.c">
|
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_wdt.c">
|
||||||
<FileOption/>
|
|
||||||
</File>
|
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_cam.c">
|
|
||||||
<FileOption/>
|
|
||||||
</File>
|
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_mjpeg.c">
|
|
||||||
<FileOption/>
|
|
||||||
</File>
|
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_flash.c">
|
|
||||||
<FileOption/>
|
|
||||||
</File>
|
|
||||||
<File Name="../../../../drivers/bl702_driver/hal_drv/src/hal_pm.c">
|
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
|
@ -154,9 +190,7 @@ Board: bl70x_iot
|
||||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romapi.c" ExcludeProjConfig="BuildSet">
|
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romapi.c" ExcludeProjConfig="BuildSet">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_romdriver.c">
|
|
||||||
<FileOption/>
|
|
||||||
</File>
|
|
||||||
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_dbg.c">
|
<File Name="../../../../drivers/bl702_driver/std_drv/src/bl702_sec_dbg.c">
|
||||||
<FileOption/>
|
<FileOption/>
|
||||||
</File>
|
</File>
|
||||||
|
@ -411,7 +445,7 @@ Board: bl70x_iot
|
||||||
<Undefine/>
|
<Undefine/>
|
||||||
<Optim>Optimize size (-Os)</Optim>
|
<Optim>Optimize size (-Os)</Optim>
|
||||||
<DebugLevel>Default (-g)</DebugLevel>
|
<DebugLevel>Default (-g)</DebugLevel>
|
||||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc</IncludePath>
|
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc</IncludePath>
|
||||||
<OtherFlags>-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 -std=c99</OtherFlags>
|
<OtherFlags>-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 -std=c99</OtherFlags>
|
||||||
<Verbose>no</Verbose>
|
<Verbose>no</Verbose>
|
||||||
<Ansi>no</Ansi>
|
<Ansi>no</Ansi>
|
||||||
|
@ -427,7 +461,7 @@ Board: bl70x_iot
|
||||||
<Asm>
|
<Asm>
|
||||||
<Define/>
|
<Define/>
|
||||||
<Undefine/>
|
<Undefine/>
|
||||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||||
<OtherFlags/>
|
<OtherFlags/>
|
||||||
<DebugLevel>gdwarf2</DebugLevel>
|
<DebugLevel>gdwarf2</DebugLevel>
|
||||||
</Asm>
|
</Asm>
|
||||||
|
@ -602,7 +636,7 @@ Board: bl70x_iot
|
||||||
<Undefine/>
|
<Undefine/>
|
||||||
<Optim>Optimize more (-O2)</Optim>
|
<Optim>Optimize more (-O2)</Optim>
|
||||||
<DebugLevel>Default (-g)</DebugLevel>
|
<DebugLevel>Default (-g)</DebugLevel>
|
||||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/libc/inc;$(ProjectPath)../../../../common/libc/inc/arm_gcc;$(ProjectPath)../../../../common/libc/inc/bits;$(ProjectPath)../../../../common/libc/inc/sys;$(ProjectPath)../../../../common/libc/src;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||||
<OtherFlags>-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 -std=c99</OtherFlags>
|
<OtherFlags>-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 -std=c99</OtherFlags>
|
||||||
<Verbose>no</Verbose>
|
<Verbose>no</Verbose>
|
||||||
<Ansi>no</Ansi>
|
<Ansi>no</Ansi>
|
||||||
|
@ -618,7 +652,7 @@ Board: bl70x_iot
|
||||||
<Asm>
|
<Asm>
|
||||||
<Define/>
|
<Define/>
|
||||||
<Undefine/>
|
<Undefine/>
|
||||||
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
<IncludePath>$(ProjectPath);$(ProjectPath)../;$(ProjectPath)../../../../components/fatfs;$(ProjectPath)../../../../components/freertos/Source/include;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../components/usb_stack/class/audio;$(ProjectPath)../../../../components/usb_stack/class/cdc;$(ProjectPath)../../../../components/usb_stack/class/hid;$(ProjectPath)../../../../components/usb_stack/class/msc;$(ProjectPath)../../../../components/usb_stack/class/video;$(ProjectPath)../../../../components/usb_stack/class/webusb;$(ProjectPath)../../../../components/usb_stack/class/winusb;$(ProjectPath)../../../../components/usb_stack/common;$(ProjectPath)../../../../components/usb_stack/core;$(ProjectPath)../../../../bsp/board/bl702;$(ProjectPath)../../../../bsp/bsp_common/platform;$(ProjectPath)../../../../common/device;$(ProjectPath)../../../../common/list;$(ProjectPath)../../../../common/memheap;$(ProjectPath)../../../../common/misc;$(ProjectPath)../../../../common/ring_buffer;$(ProjectPath)../../../../common/soft_crc;$(ProjectPath)../../../../components/shell;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl702_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl702_driver/regs;$(ProjectPath)../../../../drivers/bl702_driver/startup;$(ProjectPath)../../../../drivers/bl702_driver/std_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/risc-v/Core/Include;$(ProjectPath)../../../../drivers/bl602_driver/startup;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/inc;$(ProjectPath)../../../../drivers/bl602_driver/hal_drv/default_config;$(ProjectPath)../../../../drivers/bl602_driver/regs;$(ProjectPath)../../../../drivers/bl602_driver/std_drv/inc</IncludePath>
|
||||||
<OtherFlags/>
|
<OtherFlags/>
|
||||||
<DebugLevel>gdwarf2</DebugLevel>
|
<DebugLevel>gdwarf2</DebugLevel>
|
||||||
</Asm>
|
</Asm>
|
|
@ -33,8 +33,6 @@ int main(void)
|
||||||
writeTestData[i] = i;
|
writeTestData[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
flash_init();
|
|
||||||
|
|
||||||
/* erase 0x00010000 16k flash */
|
/* erase 0x00010000 16k flash */
|
||||||
flash_erase(0x00010000, 16 * 1024);
|
flash_erase(0x00010000, 16 * 1024);
|
||||||
|
|
5
examples/flash/flash_rw/readme.md
Normal file
5
examples/flash/flash_rw/readme.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
```bash
|
||||||
|
|
||||||
|
$ make APP=flash_read_write BOARD=bl706_iot
|
||||||
|
|
||||||
|
```
|
|
@ -1,5 +0,0 @@
|
||||||
```bash
|
|
||||||
|
|
||||||
$ make APP=flash_rw_test BOARD=bl706_iot
|
|
||||||
|
|
||||||
```
|
|
|
@ -23,8 +23,9 @@
|
||||||
#include "hal_uart.h"
|
#include "hal_uart.h"
|
||||||
#include <FreeRTOS.h>
|
#include <FreeRTOS.h>
|
||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
|
#include "bflb_platform.h"
|
||||||
|
|
||||||
static uint8_t freertos_heap[4096];
|
static uint8_t freertos_heap[configTOTAL_HEAP_SIZE];
|
||||||
|
|
||||||
static HeapRegion_t xHeapRegions[] = {
|
static HeapRegion_t xHeapRegions[] = {
|
||||||
{ (uint8_t *)freertos_heap, 0 },
|
{ (uint8_t *)freertos_heap, 0 },
|
||||||
|
@ -119,7 +120,7 @@ static void consumer_task(void *pvParameters)
|
||||||
MSG("Consumer task enter \r\n");
|
MSG("Consumer task enter \r\n");
|
||||||
vTaskDelay(1000);
|
vTaskDelay(1000);
|
||||||
MSG("Consumer task start \r\n");
|
MSG("Consumer task start \r\n");
|
||||||
MSG("begin to loop %s\n", __FILE__);
|
MSG("begin to loop %s\r\n", __FILE__);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (xSemaphoreTake(sem_full, portMAX_DELAY) == pdTRUE) {
|
if (xSemaphoreTake(sem_full, portMAX_DELAY) == pdTRUE) {
|
||||||
|
@ -164,9 +165,11 @@ int main(void)
|
||||||
{
|
{
|
||||||
bflb_platform_init(0);
|
bflb_platform_init(0);
|
||||||
|
|
||||||
xHeapRegions[0].xSizeInBytes = 4096;
|
xHeapRegions[0].xSizeInBytes = configTOTAL_HEAP_SIZE;
|
||||||
vPortDefineHeapRegions(xHeapRegions);
|
vPortDefineHeapRegions(xHeapRegions);
|
||||||
|
|
||||||
|
configASSERT((configMAX_PRIORITIES > 4));
|
||||||
|
|
||||||
/* Create semaphore */
|
/* Create semaphore */
|
||||||
vSemaphoreCreateBinary(sem_empty);
|
vSemaphoreCreateBinary(sem_empty);
|
||||||
vSemaphoreCreateBinary(sem_full);
|
vSemaphoreCreateBinary(sem_full);
|
||||||
|
@ -178,9 +181,9 @@ int main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
MSG("[OS] Starting consumer task...\r\n");
|
MSG("[OS] Starting consumer task...\r\n");
|
||||||
xTaskCreateStatic(consumer_task, (char *)"consumer_task", sizeof(consumer_stack) / 4, NULL, 16, consumer_stack, &consumer_handle);
|
xTaskCreateStatic(consumer_task, (char *)"consumer_task", sizeof(consumer_stack) / 4, NULL, configMAX_PRIORITIES - 2, consumer_stack, &consumer_handle);
|
||||||
MSG("[OS] Starting producer task...\r\n");
|
MSG("[OS] Starting producer task...\r\n");
|
||||||
xTaskCreateStatic(producer_task, (char *)"producer_task", sizeof(producer_stack) / 4, NULL, 15, producer_stack, &producer_handle);
|
xTaskCreateStatic(producer_task, (char *)"producer_task", sizeof(producer_stack) / 4, NULL, configMAX_PRIORITIES - 3, producer_stack, &producer_handle);
|
||||||
|
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
i2c_msg_t msg[2];
|
i2c_msg_t msg[2];
|
||||||
uint8_t buf[8] = { 0 };
|
uint8_t buf1[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||||
|
uint8_t buf2[8] = { 0 };
|
||||||
|
|
||||||
bflb_platform_init(0);
|
bflb_platform_init(0);
|
||||||
|
|
||||||
|
@ -38,23 +39,37 @@ int main(void)
|
||||||
device_open(i2c0, 0);
|
device_open(i2c0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg[0].buf = buf;
|
msg[0].buf = buf1;
|
||||||
msg[0].flags = SUB_ADDR_1BYTE | I2C_WR;
|
msg[0].flags = SUB_ADDR_2BYTE | I2C_WR;
|
||||||
msg[0].len = 8;
|
msg[0].len = 8;
|
||||||
msg[0].slaveaddr = 0x50;
|
msg[0].slaveaddr = 0x50;
|
||||||
msg[0].subaddr = 0x00;
|
msg[0].subaddr = 0x00;
|
||||||
|
|
||||||
msg[1].buf = buf;
|
msg[1].buf = buf2;
|
||||||
msg[1].flags = SUB_ADDR_1BYTE | I2C_RD;
|
msg[1].flags = SUB_ADDR_2BYTE | I2C_RD;
|
||||||
msg[1].len = 8;
|
msg[1].len = 8;
|
||||||
msg[1].slaveaddr = 0x50;
|
msg[1].slaveaddr = 0x50;
|
||||||
msg[1].subaddr = 0x00;
|
msg[1].subaddr = 0x00;
|
||||||
|
|
||||||
if (i2c_transfer(i2c0, &msg[0], 2) == 0) {
|
if (i2c_transfer(i2c0, &msg[0], 1) == 1) {
|
||||||
MSG("\r\n read:%0x\r\n", msg[1].buf[0] << 8 | msg[1].buf[1]);
|
|
||||||
BL_CASE_SUCCESS;
|
|
||||||
} else
|
|
||||||
BL_CASE_FAIL;
|
BL_CASE_FAIL;
|
||||||
|
while (1) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bflb_platform_delay_ms(10);
|
||||||
|
if (i2c_transfer(i2c0, &msg[1], 1) == 1) {
|
||||||
|
BL_CASE_FAIL;
|
||||||
|
while (1) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
|
if (buf1[i] != buf2[i]) {
|
||||||
|
BL_CASE_FAIL;
|
||||||
|
while (1) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BL_CASE_SUCCESS;
|
||||||
while (1) {
|
while (1) {
|
||||||
bflb_platform_delay_ms(100);
|
bflb_platform_delay_ms(100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ int main(void)
|
||||||
|
|
||||||
/* init ES8388 Codec */
|
/* init ES8388 Codec */
|
||||||
ES8388_Init(&ES8388Cfg);
|
ES8388_Init(&ES8388Cfg);
|
||||||
ES8388_Set_Voice_Volume(60);
|
ES8388_Set_Voice_Volume(20);
|
||||||
|
|
||||||
MSG("Play Music Form flash\r\n");
|
MSG("Play Music Form flash\r\n");
|
||||||
|
|
||||||
|
@ -73,10 +73,10 @@ int main(void)
|
||||||
I2S_DEV(i2s)->iis_mode = I2S_MODE_MASTER;
|
I2S_DEV(i2s)->iis_mode = I2S_MODE_MASTER;
|
||||||
I2S_DEV(i2s)->interface_mode = I2S_MODE_LEFT;
|
I2S_DEV(i2s)->interface_mode = I2S_MODE_LEFT;
|
||||||
I2S_DEV(i2s)->sampl_freq_hz = 16 * 1000;
|
I2S_DEV(i2s)->sampl_freq_hz = 16 * 1000;
|
||||||
I2S_DEV(i2s)->channel_num = I2S_FS_CHANNELS_NUM_2;
|
I2S_DEV(i2s)->channel_num = I2S_FS_CHANNELS_NUM_MONO;
|
||||||
I2S_DEV(i2s)->frame_size = I2S_FRAME_LEN_16;
|
I2S_DEV(i2s)->frame_size = I2S_FRAME_LEN_16;
|
||||||
I2S_DEV(i2s)->data_size = I2S_DATA_LEN_16;
|
I2S_DEV(i2s)->data_size = I2S_DATA_LEN_16;
|
||||||
I2S_DEV(i2s)->fifo_threshold = 8;
|
I2S_DEV(i2s)->fifo_threshold = 3;
|
||||||
device_open(i2s, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_DMA_RX);
|
device_open(i2s, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_DMA_RX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,8 @@ int main(void)
|
||||||
DMA_DEV(dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
DMA_DEV(dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
||||||
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
|
DMA_DEV(dma_ch2)->src_burst_size = DMA_BURST_4BYTE;
|
||||||
|
DMA_DEV(dma_ch2)->dst_burst_size = DMA_BURST_4BYTE;
|
||||||
device_open(dma_ch2, 0);
|
device_open(dma_ch2, 0);
|
||||||
|
|
||||||
/* connect i2s device and dma device */
|
/* connect i2s device and dma device */
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
**board/bl706_avb/pinmux_config.h** 中 **PINMUX_SELECT** 选择 **PINMUX_LVGL**
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
$ make APP=i2s_play_from_flash BOARD=bl706_avb
|
$ make APP=i2s_play_from_flash BOARD=bl706_iot
|
||||||
|
|
||||||
```
|
```
|
|
@ -73,7 +73,7 @@ int main(void)
|
||||||
I2S_DEV(i2s)->channel_num = I2S_FS_CHANNELS_NUM_2;
|
I2S_DEV(i2s)->channel_num = I2S_FS_CHANNELS_NUM_2;
|
||||||
I2S_DEV(i2s)->frame_size = I2S_FRAME_LEN_16;
|
I2S_DEV(i2s)->frame_size = I2S_FRAME_LEN_16;
|
||||||
I2S_DEV(i2s)->data_size = I2S_DATA_LEN_16;
|
I2S_DEV(i2s)->data_size = I2S_DATA_LEN_16;
|
||||||
I2S_DEV(i2s)->fifo_threshold = 8;
|
I2S_DEV(i2s)->fifo_threshold = 3;
|
||||||
device_open(i2s, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_DMA_RX);
|
device_open(i2s, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_DMA_RX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,14 +87,16 @@ int main(void)
|
||||||
DMA_DEV(dma_ch3)->dst_req = DMA_REQUEST_NONE;
|
DMA_DEV(dma_ch3)->dst_req = DMA_REQUEST_NONE;
|
||||||
DMA_DEV(dma_ch3)->src_width = DMA_TRANSFER_WIDTH_32BIT;
|
DMA_DEV(dma_ch3)->src_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||||
DMA_DEV(dma_ch3)->dst_width = DMA_TRANSFER_WIDTH_32BIT;
|
DMA_DEV(dma_ch3)->dst_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||||
|
DMA_DEV(dma_ch3)->src_burst_size = DMA_BURST_4BYTE;
|
||||||
|
DMA_DEV(dma_ch3)->dst_burst_size = DMA_BURST_4BYTE;
|
||||||
device_open(dma_ch3, 0);
|
device_open(dma_ch3, 0);
|
||||||
|
|
||||||
/* connect i2s device and dma device */
|
/* connect i2s device and dma device */
|
||||||
device_control(i2s, DEVICE_CTRL_ATTACH_RX_DMA, (void *)dma_ch3);
|
device_control(i2s, DEVICE_CTRL_ATTACH_RX_DMA, (void *)dma_ch3);
|
||||||
|
|
||||||
/* Set the interrupt function, for double buffering*/
|
/* Set the interrupt function, for double buffering*/
|
||||||
device_set_callback(dma_ch3, dma_ch3_irq_callback);
|
device_set_callback(I2S_DEV(i2s)->rx_dma, dma_ch3_irq_callback);
|
||||||
device_control(dma_ch3, DEVICE_CTRL_SET_INT, NULL);
|
device_control(I2S_DEV(i2s)->rx_dma, DEVICE_CTRL_SET_INT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
dma_register(DMA0_CH2_INDEX, "dma_ch2_i2s_tx");
|
dma_register(DMA0_CH2_INDEX, "dma_ch2_i2s_tx");
|
||||||
|
@ -106,14 +108,16 @@ int main(void)
|
||||||
DMA_DEV(dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
DMA_DEV(dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
||||||
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_32BIT;
|
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||||
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_32BIT;
|
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||||
|
DMA_DEV(dma_ch2)->src_burst_size = DMA_BURST_4BYTE;
|
||||||
|
DMA_DEV(dma_ch2)->dst_burst_size = DMA_BURST_4BYTE;
|
||||||
device_open(dma_ch2, 0);
|
device_open(dma_ch2, 0);
|
||||||
|
|
||||||
/* connect i2s device and dma device */
|
/* connect i2s device and dma device */
|
||||||
device_control(i2s, DEVICE_CTRL_ATTACH_TX_DMA, (void *)dma_ch2);
|
device_control(i2s, DEVICE_CTRL_ATTACH_TX_DMA, (void *)dma_ch2);
|
||||||
|
|
||||||
/* Set the interrupt function, for double buffering*/
|
/* Set the interrupt function, for double buffering*/
|
||||||
device_set_callback(dma_ch2, NULL);
|
device_set_callback(I2S_DEV(i2s)->tx_dma, NULL);
|
||||||
device_control(dma_ch2, DEVICE_CTRL_SET_INT, NULL);
|
device_control(I2S_DEV(i2s)->tx_dma, DEVICE_CTRL_SET_INT, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
uart = device_find("debug_log");
|
uart = device_find("debug_log");
|
||||||
|
|
|
@ -90,14 +90,14 @@ int main(void)
|
||||||
MSG("fatfs open ERROR\r\n");
|
MSG("fatfs open ERROR\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_START, NULL);
|
Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_PLAY_START, NULL);
|
||||||
|
|
||||||
/* start/stop test */
|
/* start/stop test */
|
||||||
/*
|
/*
|
||||||
bflb_platform_delay_ms(10000);
|
bflb_platform_delay_ms(10000);
|
||||||
Audio_Dev.audio_control(&Audio_Dev,AUDIO_CMD_STOP,NULL);
|
Audio_Dev.audio_control(&Audio_Dev,AUDIO_CMD_PLAY_STOP,NULL);
|
||||||
bflb_platform_delay_ms(5000);
|
bflb_platform_delay_ms(5000);
|
||||||
Audio_Dev.audio_control(&Audio_Dev,AUDIO_CMD_START,NULL);
|
Audio_Dev.audio_control(&Audio_Dev,AUDIO_CMD_PLAY_START,NULL);
|
||||||
bflb_platform_delay_ms(5000);
|
bflb_platform_delay_ms(5000);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
**board/bl706_avb/pinmux_config.h** 中 **PINMUX_SELECT** 选择 **PINMUX_LVGL**
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
$ make APP=i2s_play_from_sd BOARD=bl706_avb
|
$ make APP=i2s_play_from_sd BOARD=bl706_iot
|
||||||
|
|
||||||
```
|
```
|
|
@ -108,7 +108,7 @@ int cmd_play(size_t argc, char **argv)
|
||||||
|
|
||||||
if (flag & 0x01) /* -s */
|
if (flag & 0x01) /* -s */
|
||||||
{
|
{
|
||||||
if (Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_START, NULL) != 0) {
|
if (Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_PLAY_START, NULL) != 0) {
|
||||||
MSG("play start error\r\n");
|
MSG("play start error\r\n");
|
||||||
} else {
|
} else {
|
||||||
MSG("play start \r\n");
|
MSG("play start \r\n");
|
||||||
|
@ -117,7 +117,7 @@ int cmd_play(size_t argc, char **argv)
|
||||||
|
|
||||||
if (flag & 0x02) /* -p */
|
if (flag & 0x02) /* -p */
|
||||||
{
|
{
|
||||||
if (Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_STOP, NULL) != 0) {
|
if (Audio_Dev.audio_control(&Audio_Dev, AUDIO_CMD_PLAY_STOP, NULL) != 0) {
|
||||||
MSG("play stop error\r\n");
|
MSG("play stop error\r\n");
|
||||||
} else {
|
} else {
|
||||||
MSG("play stop \r\n");
|
MSG("play stop \r\n");
|
||||||
|
|
|
@ -184,23 +184,23 @@ static int sd_wav_play_init(audio_dev_t *audio_dev, const TCHAR *path)
|
||||||
|
|
||||||
if ((audio_dev->device) && dma_ch2) {
|
if ((audio_dev->device) && dma_ch2) {
|
||||||
/* I2S Config */
|
/* I2S Config */
|
||||||
((i2s_device_t *)(audio_dev->device))->interface_mode = I2S_MODE_LEFT;
|
I2S_DEV(audio_dev->device)->interface_mode = I2S_MODE_LEFT;
|
||||||
((i2s_device_t *)(audio_dev->device))->sampl_freq_hz = audio_dev->wav_information->chunk_format.sample_rate;
|
I2S_DEV(audio_dev->device)->sampl_freq_hz = audio_dev->wav_information->chunk_format.sample_rate;
|
||||||
((i2s_device_t *)(audio_dev->device))->channel_num = audio_dev->wav_information->chunk_format.num_of_channels;
|
I2S_DEV(audio_dev->device)->channel_num = audio_dev->wav_information->chunk_format.num_of_channels;
|
||||||
uint8_t pcm_w = audio_dev->wav_information->chunk_format.bits_per_sample / 8;
|
uint8_t pcm_w = audio_dev->wav_information->chunk_format.bits_per_sample / 8;
|
||||||
|
|
||||||
if (pcm_w <= 2) {
|
if (pcm_w <= 2) {
|
||||||
((i2s_device_t *)(audio_dev->device))->frame_size = I2S_FRAME_LEN_16;
|
I2S_DEV(audio_dev->device)->frame_size = I2S_FRAME_LEN_16;
|
||||||
} else {
|
} else {
|
||||||
((i2s_device_t *)(audio_dev->device))->frame_size = I2S_FRAME_LEN_32;
|
I2S_DEV(audio_dev->device)->frame_size = I2S_FRAME_LEN_32;
|
||||||
}
|
}
|
||||||
|
|
||||||
((i2s_device_t *)(audio_dev->device))->data_size = ((i2s_device_t *)(audio_dev->device))->frame_size;
|
I2S_DEV(audio_dev->device)->data_size = I2S_DEV(audio_dev->device)->frame_size;
|
||||||
((i2s_device_t *)(audio_dev->device))->fifo_threshold = 8;
|
I2S_DEV(audio_dev->device)->fifo_threshold = 3;
|
||||||
res = device_open((audio_dev->device), DEVICE_OFLAG_DMA_TX);
|
res = device_open((audio_dev->device), DEVICE_OFLAG_DMA_TX);
|
||||||
|
|
||||||
/* ES8388 Config */
|
/* ES8388 Config */
|
||||||
switch (((i2s_device_t *)(audio_dev->device))->data_size) {
|
switch (I2S_DEV(audio_dev->device)->data_size) {
|
||||||
case I2S_FRAME_LEN_16:
|
case I2S_FRAME_LEN_16:
|
||||||
ES8388Cfg.data_width = ES8388_DATA_LEN_16;
|
ES8388Cfg.data_width = ES8388_DATA_LEN_16;
|
||||||
break;
|
break;
|
||||||
|
@ -221,30 +221,32 @@ static int sd_wav_play_init(audio_dev_t *audio_dev, const TCHAR *path)
|
||||||
ES8388_Init(&ES8388Cfg);
|
ES8388_Init(&ES8388Cfg);
|
||||||
ES8388_Set_Voice_Volume(20);
|
ES8388_Set_Voice_Volume(20);
|
||||||
|
|
||||||
MSG("sampl_freq_hz : %d\r\n", ((i2s_device_t *)(audio_dev->device))->sampl_freq_hz);
|
MSG("sampl_freq_hz : %d\r\n", I2S_DEV(audio_dev->device)->sampl_freq_hz);
|
||||||
MSG("channel_num : %d\r\n", ((i2s_device_t *)(audio_dev->device))->channel_num);
|
MSG("channel_num : %d\r\n", I2S_DEV(audio_dev->device)->channel_num);
|
||||||
MSG("data_size : %d\r\n", ((i2s_device_t *)(audio_dev->device))->data_size);
|
MSG("data_size : %d\r\n", I2S_DEV(audio_dev->device)->data_size);
|
||||||
|
|
||||||
/* DMA Config */
|
/* DMA Config */
|
||||||
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
DMA_DEV(dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||||
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
DMA_DEV(dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||||
((dma_device_t *)dma_ch2)->src_req = (uint32_t)NULL;
|
DMA_DEV(dma_ch2)->src_req = DMA_REQUEST_NONE;
|
||||||
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
DMA_DEV(dma_ch2)->dst_req = DMA_REQUEST_I2S_TX;
|
||||||
|
DMA_DEV(dma_ch2)->src_burst_size = DMA_BURST_4BYTE;
|
||||||
|
DMA_DEV(dma_ch2)->dst_burst_size = DMA_BURST_4BYTE;
|
||||||
|
|
||||||
switch (((i2s_device_t *)(audio_dev->device))->data_size * ((i2s_device_t *)(audio_dev->device))->channel_num) {
|
switch (I2S_DEV(audio_dev->device)->data_size * I2S_DEV(audio_dev->device)->channel_num) {
|
||||||
case I2S_DATA_LEN_8:
|
case I2S_DATA_LEN_8:
|
||||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_8BIT;
|
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_8BIT;
|
||||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_8BIT;
|
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_8BIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case I2S_DATA_LEN_16:
|
case I2S_DATA_LEN_16:
|
||||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_32BIT;
|
DMA_DEV(dma_ch2)->src_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_32BIT;
|
DMA_DEV(dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_32BIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +283,7 @@ static int sd_wav_play_control(struct audio_dev *audio_dev, AUDIO_CMD_t cmd, voi
|
||||||
int res = -1;
|
int res = -1;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case AUDIO_CMD_START:
|
case AUDIO_CMD_PLAY_START:
|
||||||
if (audio_dev->audio_state) {
|
if (audio_dev->audio_state) {
|
||||||
res = device_write(audio_dev->device, 0, audio_dev->buff[!audio_dev->buff_using], audio_dev->buff_data_size[!audio_dev->buff_using]);
|
res = device_write(audio_dev->device, 0, audio_dev->buff[!audio_dev->buff_using], audio_dev->buff_data_size[!audio_dev->buff_using]);
|
||||||
audio_dev->audio_state = 2;
|
audio_dev->audio_state = 2;
|
||||||
|
@ -290,7 +292,7 @@ static int sd_wav_play_control(struct audio_dev *audio_dev, AUDIO_CMD_t cmd, voi
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUDIO_CMD_STOP:
|
case AUDIO_CMD_PLAY_STOP:
|
||||||
if (audio_dev->audio_state) {
|
if (audio_dev->audio_state) {
|
||||||
audio_dev->audio_state = 1;
|
audio_dev->audio_state = 1;
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
|
@ -82,8 +82,8 @@ typedef struct
|
||||||
} wav_information_t;
|
} wav_information_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AUDIO_CMD_START,
|
AUDIO_CMD_PLAY_START,
|
||||||
AUDIO_CMD_STOP,
|
AUDIO_CMD_PLAY_STOP,
|
||||||
AUDIO_CMD_VOLUME,
|
AUDIO_CMD_VOLUME,
|
||||||
} AUDIO_CMD_t;
|
} AUDIO_CMD_t;
|
||||||
|
|
||||||
|
|
|
@ -21,20 +21,19 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "hal_uart.h"
|
#include "hal_uart.h"
|
||||||
#include "drv_mmheap.h"
|
|
||||||
|
|
||||||
int memheap_test(void)
|
int memheap_test(void)
|
||||||
{
|
{
|
||||||
char *ptr = NULL; /* 内存块的指针 */
|
char *ptr = NULL; /* 内存块的指针 */
|
||||||
|
|
||||||
for (int i = 1;; i++) {
|
for (int i = 1;; i++) {
|
||||||
ptr = mmheap_alloc(i * 128);
|
ptr = malloc(i * 128);
|
||||||
|
|
||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
memcpy(ptr, "hello123456789123456789123456789", 33);
|
memcpy(ptr, "hello123456789123456789123456789", 33);
|
||||||
MSG("ptr :%s\n", ptr);
|
MSG("ptr :%s\n", ptr);
|
||||||
MSG("get memory :%d byte\n", i * 128);
|
MSG("get memory :%d byte\n", i * 128);
|
||||||
mmheap_free(ptr);
|
free(ptr);
|
||||||
MSG("free memory :%d byte\n", i * 128);
|
MSG("free memory :%d byte\n", i * 128);
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
bflb_platform_delay_ms(100);
|
bflb_platform_delay_ms(100);
|
||||||
|
|
|
@ -66,10 +66,17 @@ int pds3_enter(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
int pds31_enter(int argc, char *argv[])
|
int pds31_enter(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
int second = 0;
|
||||||
|
|
||||||
|
if (argc == 2) {
|
||||||
|
second = atoi(argv[1]);
|
||||||
|
} else {
|
||||||
|
second = 0;
|
||||||
|
}
|
||||||
MSG("gpio wake up case,enter pds31 mode\r\n");
|
MSG("gpio wake up case,enter pds31 mode\r\n");
|
||||||
bflb_platform_delay_ms(50);
|
bflb_platform_delay_ms(50);
|
||||||
|
|
||||||
pm_pds_mode_enter(PM_PDS_LEVEL_31, 0); /*hbn、pds gpio can wakeup*/
|
pm_pds_mode_enter(PM_PDS_LEVEL_31, second); /*hbn、pds gpio can wakeup*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,9 @@ int main(void)
|
||||||
struct device *led_breath = device_find("led_breath");
|
struct device *led_breath = device_find("led_breath");
|
||||||
|
|
||||||
if (led_breath) {
|
if (led_breath) {
|
||||||
PWM_DEV(led_breath)->period = 32; //frequence = 32M/1/32 = 1Mhz
|
PWM_DEV(led_breath)->period = 10; //frequence = 32K/32/10 = 100HZ
|
||||||
PWM_DEV(led_breath)->threshold_low = 16;
|
PWM_DEV(led_breath)->threshold_low = 5;
|
||||||
PWM_DEV(led_breath)->threshold_high = 32;
|
PWM_DEV(led_breath)->threshold_high = 10;
|
||||||
device_open(led_breath, DEVICE_OFLAG_STREAM_TX);
|
device_open(led_breath, DEVICE_OFLAG_STREAM_TX);
|
||||||
pwm_channel_start(led_breath);
|
pwm_channel_start(led_breath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
**board/bl706_iot/clock_config.h** 中
|
**board/bl706_iot/clock_config.h** 中
|
||||||
|
|
||||||
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_XCLK**,
|
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_32K_CLK**,
|
||||||
- **BSP_PWM_CLOCK_DIV** 设置成 **1**
|
- **BSP_PWM_CLOCK_DIV** 设置成 **32**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,13 @@ int main(void)
|
||||||
struct device *pwm = device_find("pwm");
|
struct device *pwm = device_find("pwm");
|
||||||
|
|
||||||
if (pwm) {
|
if (pwm) {
|
||||||
PWM_DEV(pwm)->period = 32; //frequence = 32M/1/32 = 1Mhz
|
PWM_DEV(pwm)->period = 10; //frequence = 32k/32/10 = 100hz
|
||||||
PWM_DEV(pwm)->threshold_low = 16;
|
PWM_DEV(pwm)->threshold_low = 5;
|
||||||
PWM_DEV(pwm)->threshold_high = 32;
|
PWM_DEV(pwm)->threshold_high = 10;
|
||||||
PWM_DEV(pwm)->it_pulse_count = 16;
|
PWM_DEV(pwm)->it_pulse_count = 200; //after 2s go isr 2s = 1/100hz*200
|
||||||
device_open(pwm, DEVICE_OFLAG_INT_TX);
|
device_open(pwm, DEVICE_OFLAG_INT_TX);
|
||||||
device_set_callback(pwm, pwm_irq_callback);
|
device_set_callback(pwm, pwm_irq_callback);
|
||||||
//pwm_it_pulse_count_update(pwm, 16);
|
//pwm_it_pulse_count_update(pwm, 200);
|
||||||
pwm_channel_start(pwm);
|
pwm_channel_start(pwm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
**board/bl706_iot/clock_config.h** 中
|
**board/bl706_iot/clock_config.h** 中
|
||||||
|
|
||||||
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_XCLK**,
|
- **BSP_PWM_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_32K_CLK**,
|
||||||
- **BSP_PWM_CLOCK_DIV** 设置成 **1**
|
- **BSP_PWM_CLOCK_DIV** 设置成 **32**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||||
|
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/es8388 ${BSP_COMMON_DIR}/wm8978 ${BSP_COMMON_DIR}/spi_sd)
|
||||||
|
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/es8388/bsp_es8388.c ${BSP_COMMON_DIR}/wm8978/wm8978.c )
|
||||||
set(mains main.c)
|
set(mains main.c)
|
||||||
generate_bin()
|
generate_bin()
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
const unsigned char fhm_onechannel_16k_20[] __attribute((aligned(4)));
|
const unsigned char fhm_onechannel_16k_20[] __attribute((aligned(4)));
|
||||||
//total len:640044 bytes
|
//total len:640044 bytes
|
||||||
const unsigned char fhm_onechannel_16k_20[] = {
|
const unsigned char fhm_onechannel_16k_20[] = {
|
||||||
|
0x00,
|
||||||
|
0xff,
|
||||||
|
0x00,
|
||||||
|
0xff,
|
||||||
|
|
||||||
0x52,
|
0x52,
|
||||||
0x49,
|
0x49,
|
||||||
0x46,
|
0x46,
|
||||||
|
|
|
@ -25,11 +25,27 @@
|
||||||
#include "hal_uart.h"
|
#include "hal_uart.h"
|
||||||
#include "hal_gpio.h"
|
#include "hal_gpio.h"
|
||||||
#include "hal_dma.h"
|
#include "hal_dma.h"
|
||||||
|
#include "bl702_glb.h"
|
||||||
|
#include "bl702_spi.h"
|
||||||
#include "fhm_onechannel_16k_20.h"
|
#include "fhm_onechannel_16k_20.h"
|
||||||
|
|
||||||
#define SPI0_CS GPIO_PIN_10
|
/***************************************************************
|
||||||
#define ES8374_SLAVE_ADDR 0x10
|
MARCO Definition
|
||||||
|
****************************************************************/
|
||||||
|
#define AUTIO_ES8388 0
|
||||||
|
#define AUTIO_WM8978 1
|
||||||
|
#define AUTIO_MODULE_TYPE AUTIO_ES8388
|
||||||
|
|
||||||
|
#if (AUTIO_MODULE_TYPE == AUTIO_ES8388)
|
||||||
|
#include "bsp_es8388.h"
|
||||||
|
#elif (AUTIO_MODULE_TYPE == AUTIO_WM8978)
|
||||||
|
#include "wm8978.h"
|
||||||
|
#else
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
Struct Declaration
|
||||||
|
****************************************************************/
|
||||||
typedef struct audio_dev {
|
typedef struct audio_dev {
|
||||||
uint8_t *buff1;
|
uint8_t *buff1;
|
||||||
uint8_t *buff2;
|
uint8_t *buff2;
|
||||||
|
@ -48,21 +64,26 @@ typedef struct audio_dev {
|
||||||
struct device *device;
|
struct device *device;
|
||||||
} audio_dev_t;
|
} audio_dev_t;
|
||||||
|
|
||||||
int record_callback(audio_dev_t *audio_dev);
|
#if (AUTIO_MODULE_TYPE == AUTIO_ES8388)
|
||||||
|
static ES8388_Cfg_Type ES8388Cfg = {
|
||||||
audio_dev_t Audio_Dev = { 0 };
|
.work_mode = ES8388_CODEC_MDOE, /*!< ES8388 work mode */
|
||||||
|
.role = ES8388_MASTER, /*!< ES8388 role */
|
||||||
|
.mic_input_mode = ES8388_DIFF_ENDED_MIC, /*!< ES8388 mic input mode */
|
||||||
|
.mic_pga = ES8388_MIC_PGA_9DB, /*!< ES8388 mic PGA */
|
||||||
|
.i2s_frame = ES8388_LEFT_JUSTIFY_FRAME, //ES8388_LEFT_JUSTIFY_FRAME, /*!< ES8388 I2S frame */
|
||||||
|
.data_width = ES8388_DATA_LEN_16, //ES8388_DATA_LEN_16, /*!< ES8388 I2S dataWitdh */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
/***************************************************************
|
||||||
|
Variable Definition
|
||||||
|
****************************************************************/
|
||||||
|
audio_dev_t audio_dev0 = { 0 };
|
||||||
struct device *spi0;
|
struct device *spi0;
|
||||||
struct device *i2c0;
|
struct device *dma_ch2;
|
||||||
struct device *dma_ch2; //spi tx
|
|
||||||
|
|
||||||
uint8_t test_buff[4 * 1024];
|
|
||||||
|
|
||||||
void dma_ch2_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
|
||||||
{
|
|
||||||
record_callback(&Audio_Dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
Function Definition
|
||||||
|
****************************************************************/
|
||||||
uint8_t spi_init(void)
|
uint8_t spi_init(void)
|
||||||
{
|
{
|
||||||
spi_register(SPI0_INDEX, "spi0");
|
spi_register(SPI0_INDEX, "spi0");
|
||||||
|
@ -71,12 +92,13 @@ uint8_t spi_init(void)
|
||||||
|
|
||||||
if (spi0) {
|
if (spi0) {
|
||||||
((spi_device_t *)spi0)->mode = SPI_SLVAE_MODE;
|
((spi_device_t *)spi0)->mode = SPI_SLVAE_MODE;
|
||||||
((spi_device_t *)spi0)->direction = SPI_MSB_BYTE0_DIRECTION_FIRST;
|
((spi_device_t *)spi0)->direction = SPI_MSB_BYTE3_DIRECTION_FIRST;
|
||||||
((spi_device_t *)spi0)->clk_polaraity = SPI_POLARITY_HIGH;
|
((spi_device_t *)spi0)->clk_polaraity = SPI_POLARITY_HIGH;
|
||||||
((spi_device_t *)spi0)->datasize = SPI_DATASIZE_16BIT;
|
((spi_device_t *)spi0)->datasize = SPI_DATASIZE_16BIT;
|
||||||
((spi_device_t *)spi0)->clk_phase = SPI_PHASE_1EDGE;
|
((spi_device_t *)spi0)->clk_phase = SPI_PHASE_1EDGE;
|
||||||
((spi_device_t *)spi0)->fifo_threshold = 2;
|
((spi_device_t *)spi0)->fifo_threshold = 3;
|
||||||
|
|
||||||
|
//dma send spi
|
||||||
device_open(spi0, DEVICE_OFLAG_DMA_TX);
|
device_open(spi0, DEVICE_OFLAG_DMA_TX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,13 +106,15 @@ uint8_t spi_init(void)
|
||||||
|
|
||||||
if (dma_ch2) {
|
if (dma_ch2) {
|
||||||
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||||
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_CYCLE_MODE;
|
||||||
((dma_device_t *)dma_ch2)->src_req = DMA_REQUEST_NONE;
|
((dma_device_t *)dma_ch2)->src_req = DMA_REQUEST_NONE;
|
||||||
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_SPI0_TX;
|
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_SPI0_TX;
|
||||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
|
((dma_device_t *)dma_ch2)->src_burst_size = 0;
|
||||||
|
((dma_device_t *)dma_ch2)->dst_burst_size = 0;
|
||||||
device_open(dma_ch2, 0);
|
device_open(dma_ch2, 0);
|
||||||
device_set_callback(dma_ch2, dma_ch2_irq_callback);
|
device_set_callback(dma_ch2, NULL);
|
||||||
device_control(dma_ch2, DEVICE_CTRL_SET_INT, NULL);
|
device_control(dma_ch2, DEVICE_CTRL_SET_INT, NULL);
|
||||||
device_control(spi0, DEVICE_CTRL_ATTACH_TX_DMA, dma_ch2);
|
device_control(spi0, DEVICE_CTRL_ATTACH_TX_DMA, dma_ch2);
|
||||||
}
|
}
|
||||||
|
@ -98,180 +122,88 @@ uint8_t spi_init(void)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void i2c_init(void)
|
ATTR_TCM_SECTION int main(void)
|
||||||
{
|
{
|
||||||
i2c_register(I2C0_INDEX, "i2c");
|
uint8_t flag = 0;
|
||||||
i2c0 = device_find("i2c");
|
GLB_GPIO_Cfg_Type gpio_cfg;
|
||||||
|
|
||||||
if (i2c0) {
|
audio_dev0.buff1 = (void *)fhm_onechannel_16k_20;
|
||||||
((i2c_device_t *)i2c0)->id = 0;
|
audio_dev0.buff_size_max = sizeof(fhm_onechannel_16k_20);
|
||||||
((i2c_device_t *)i2c0)->mode = I2C_HW_MODE;
|
audio_dev0.buff1_data_size = sizeof(fhm_onechannel_16k_20);
|
||||||
((i2c_device_t *)i2c0)->phase = 15;
|
audio_dev0.audio_state = 1;
|
||||||
device_open(i2c0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int es8374_write_reg(uint8_t addr, uint8_t data)
|
|
||||||
{
|
|
||||||
i2c_msg_t msg1;
|
|
||||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
|
||||||
msg1.len = 1,
|
|
||||||
msg1.buf = &data;
|
|
||||||
msg1.flags = SUB_ADDR_1BYTE | I2C_WR;
|
|
||||||
msg1.subaddr = addr;
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
return i2c_transfer(i2c0, &msg1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
BL_Err_Type es8388_read_reg(uint8_t addr, uint8_t *rdata)
|
|
||||||
{
|
|
||||||
i2c_msg_t msg1;
|
|
||||||
msg1.len = 1,
|
|
||||||
msg1.buf = rdata;
|
|
||||||
msg1.subaddr = addr;
|
|
||||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
|
||||||
msg1.flags = SUB_ADDR_1BYTE | I2C_RD;
|
|
||||||
return i2c_transfer(i2c0, &msg1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t es8374_config_master(void)
|
|
||||||
{
|
|
||||||
es8374_write_reg(0x00, 0x3F);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x00, 0x03);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x01, 0x7F);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x05, 0x11);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x6F, 0xA0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x72, 0x41);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x09, 0x01);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0C, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0D, 0x13);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0E, 0xE0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0A, 0x3A);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0B, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x09, 0x41);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x24, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x36, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x12, 0x30);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x13, 0x20);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x21, 0x50);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x22, 0x55);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x21, 0x24);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x00, 0x80);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x14, 0x8A);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x15, 0x40);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1A, 0xA0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1B, 0x19);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1C, 0x90);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1D, 0x2B);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1F, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1E, 0xA0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x28, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x25, 0x1F);
|
|
||||||
bflb_platform_delay_ms(10); //增益
|
|
||||||
es8374_write_reg(0x38, 0x00);
|
|
||||||
bflb_platform_delay_ms(10); //DAC音量
|
|
||||||
es8374_write_reg(0x37, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x6D, 0x60);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x03, 0x20);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x06, 0x03);
|
|
||||||
bflb_platform_delay_ms(10); // 0x0600 ---8K sample. 0x0300 -16K
|
|
||||||
es8374_write_reg(0x07, 0x00);
|
|
||||||
bflb_platform_delay_ms(10); //
|
|
||||||
es8374_write_reg(0x0F, 0x95);
|
|
||||||
bflb_platform_delay_ms(10); //0x9D 8K 0x95 16K
|
|
||||||
es8374_write_reg(0x10, 0x0D);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x11, 0x0D);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x02, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t es8374_config_dump(void)
|
|
||||||
{
|
|
||||||
uint8_t i = 0;
|
|
||||||
uint8_t val = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < 0X6D; i++) {
|
|
||||||
es8388_read_reg(i, &val);
|
|
||||||
MSG("0x%x = 0x%x\r\n", i, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int record_init(audio_dev_t *audio_dev)
|
|
||||||
{
|
|
||||||
audio_dev->buff1 = (void *)fhm_onechannel_16k_20;
|
|
||||||
audio_dev->buff_size_max = sizeof(fhm_onechannel_16k_20);
|
|
||||||
audio_dev->buff1_data_size = sizeof(fhm_onechannel_16k_20);
|
|
||||||
audio_dev->audio_state = 1;
|
|
||||||
|
|
||||||
i2c_init();
|
|
||||||
es8374_config_master();
|
|
||||||
//es8374_config_dump();
|
|
||||||
//memset(test_buff,0x55,sizeof(test_buff));
|
|
||||||
|
|
||||||
spi_init();
|
|
||||||
MSG("play start\r\n");
|
|
||||||
device_write(spi0, 0, audio_dev->buff1, audio_dev->buff1_data_size);
|
|
||||||
audio_dev->buff_using = 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int record_callback(audio_dev_t *audio_dev)
|
|
||||||
{
|
|
||||||
MSG("play end\r\n");
|
|
||||||
MSG("play start\r\n");
|
|
||||||
device_write(spi0, 0, audio_dev->buff1, audio_dev->buff1_data_size);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
bflb_platform_init(0);
|
bflb_platform_init(0);
|
||||||
|
|
||||||
MSG("spi_i2s_record case \r\n");
|
MSG("spi i2s mono play start...\r\n");
|
||||||
|
flag = spi_init();
|
||||||
|
if (flag) {
|
||||||
|
MSG("[E]spi init fail!\r\n");
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
record_init(&Audio_Dev);
|
/* Disable spi dev */
|
||||||
|
device_control(spi0, DEVICE_CTRL_SUSPEND, NULL);
|
||||||
|
|
||||||
|
/* Spi CS pin config input mode*/
|
||||||
|
gpio_cfg.gpioMode = GPIO_MODE_AF;
|
||||||
|
gpio_cfg.pullType = GPIO_PULL_UP;
|
||||||
|
gpio_cfg.gpioPin = GPIO_PIN_10;
|
||||||
|
gpio_cfg.gpioFun = GPIO_FUN_UNUSED;
|
||||||
|
GLB_GPIO_Init(&gpio_cfg);
|
||||||
|
gpio_set_mode(GPIO_PIN_10, GPIO_INPUT_PP_MODE);
|
||||||
|
|
||||||
|
/*GPIO6 output clk for I2S MCLK*/
|
||||||
|
GLB_Set_Chip_Out_0_CLK_Sel(GLB_CHIP_CLK_OUT_I2S_REF_CLK);
|
||||||
|
GLB_Set_I2S_CLK(ENABLE, GLB_I2S_OUT_REF_CLK_NONE);
|
||||||
|
|
||||||
|
#if (AUTIO_MODULE_TYPE == AUTIO_WM8978)
|
||||||
|
|
||||||
|
/*init wm8978*/
|
||||||
|
if (0 != WM8978_Init()) {
|
||||||
|
MSG("[E]WM8978 Init fail\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false == wm8978_master_cfg()) {
|
||||||
|
MSG("[E]wm8978 master cfg fail! \r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
WM8978_PlayMode();
|
||||||
|
#elif (AUTIO_MODULE_TYPE == AUTIO_ES8388)
|
||||||
|
/* init ES8388 Codec */
|
||||||
|
ES8388_Init(&ES8388Cfg);
|
||||||
|
//ES8388_Reg_Dump();
|
||||||
|
flag = ES8388_Set_Voice_Volume(30);
|
||||||
|
if (flag) {
|
||||||
|
MSG("[E]ES8388 set volume fail!\r\n");
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
MSG("ES8388 config ok!\r\n");
|
||||||
|
#else
|
||||||
|
MSG("[E]Please Check AUTIO_MODULE_TYPE!\r\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Config DMA Tx Buff */
|
||||||
|
device_write(spi0, 0, audio_dev0.buff1, audio_dev0.buff1_data_size);
|
||||||
|
|
||||||
|
gpio_cfg.gpioMode = GPIO_MODE_AF;
|
||||||
|
gpio_cfg.pullType = GPIO_PULL_UP;
|
||||||
|
gpio_cfg.gpioPin = GPIO_PIN_10;
|
||||||
|
gpio_cfg.gpioFun = GPIO_FUN_SPI;
|
||||||
|
|
||||||
|
/* Wait SPI CS Rise edge */
|
||||||
|
while (gpio_read(GPIO_PIN_10))
|
||||||
|
;
|
||||||
|
|
||||||
|
while (!gpio_read(GPIO_PIN_10))
|
||||||
|
;
|
||||||
|
|
||||||
|
/* Config GPIO10 as SPI CS*/
|
||||||
|
GLB_GPIO_Init(&gpio_cfg);
|
||||||
|
|
||||||
|
/* Enable spi dev */
|
||||||
|
device_control(spi0, DEVICE_CTRL_RESUME, NULL);
|
||||||
|
|
||||||
BL_CASE_SUCCESS;
|
|
||||||
while (1) {
|
while (1) {
|
||||||
bflb_platform_delay_ms(100);
|
bflb_platform_delay_ms(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,31 @@
|
||||||
**board/bl706_avb/pinmux_config.h** 中 **PINMUX_SELECT** 选择 **PINMUX_LVGL**
|
## 修改程序
|
||||||
|
-- **board/bl706_avb/pinmux_config.h** 中 **PINMUX_SELECT** 选择 **PINMUX_LVGL**
|
||||||
|
|
||||||
|
-- **board/bl706_avb/pinmux_config.h** 中 **CONFIG_GPIO10_FUNC** 、 **CONFIG_GPIO19_FUNC** 、 **CONFIG_GPIO20_FUNC** 、 **CONFIG_GPIO21_FUNC**选择 **GPIO_FUN_SPI**
|
||||||
|
|
||||||
|
-- **board/bl706_avb/pinmux_config.h** 中 **CONFIG_GPIO11_FUNC** 、 **CONFIG_GPIO16_FUNC**选择 **GPIO_FUN_I2C**
|
||||||
|
|
||||||
|
-- **board/bl706_avb/pinmux_config.h** 中 **CONFIG_GPIO6_FUNC** 选择 **GPIO_FUN_CLK_OUT**
|
||||||
|
|
||||||
|
-- **board/bl706_avb/clock_config.h** 中 **BSP_AUDIO_PLL_CLOCK_SOURCE** 选择 **ROOT_CLOCK_SOURCE_AUPLL_12288000_HZ**
|
||||||
|
|
||||||
|
## 编译命令
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
$ make APP=spi_i2s_mono_play BOARD=bl706_avb
|
$ make APP=spi_i2s_mono_play BOARD=bl706_avb
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 硬件环境
|
||||||
|
- **BL706_AVB** 开发板上的 **FUN2** 接上跳线帽;
|
||||||
|
- 准备音频模组 **ES8388** 或者 **WM8978** ;
|
||||||
|
- 连线方式:
|
||||||
|
|
||||||
|
| AVB_Board | Audio_Module |
|
||||||
|
| :------ | :------ |
|
||||||
|
| I2C-SCL | I2C-SCL |
|
||||||
|
| I2C-SDA | I2C-SDA |
|
||||||
|
| SPI-CS | I2S-FS |
|
||||||
|
| SPI-SCK | I2S-BCLK |
|
||||||
|
| SPI-MISO | I2S-DO/SDA |
|
||||||
|
| I2S-MCLK | I2S-MCLK |
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
set(BSP_COMMON_DIR ${CMAKE_SOURCE_DIR}/bsp/bsp_common)
|
||||||
set(TARGET_REQUIRED_LIBS fatfs)
|
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/es8388 ${BSP_COMMON_DIR}/wm8978 ${BSP_COMMON_DIR}/spi_sd)
|
||||||
set(TARGET_REQUIRED_PRIVATE_INCLUDE ${BSP_COMMON_DIR}/es8388)
|
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/es8388/bsp_es8388.c ${BSP_COMMON_DIR}/wm8978/wm8978.c )
|
||||||
set(TARGET_REQUIRED_SRCS ${BSP_COMMON_DIR}/es8388/bsp_es8388.c)
|
|
||||||
set(mains main.c)
|
set(mains main.c)
|
||||||
generate_bin()
|
generate_bin()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,23 +20,24 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "bl702_glb.h"
|
||||||
|
#include "bl702_spi.h"
|
||||||
#include "hal_spi.h"
|
#include "hal_spi.h"
|
||||||
#include "hal_i2c.h"
|
#include "hal_i2c.h"
|
||||||
#include "hal_uart.h"
|
#include "hal_uart.h"
|
||||||
#include "hal_gpio.h"
|
#include "hal_gpio.h"
|
||||||
#include "hal_dma.h"
|
#include "hal_dma.h"
|
||||||
|
#include "bsp_es8388.h"
|
||||||
|
|
||||||
#define SPI0_CS GPIO_PIN_10
|
#define SPI0_CS GPIO_PIN_10
|
||||||
#define ES8374_SLAVE_ADDR 0x10
|
|
||||||
|
|
||||||
//播放控制块
|
//播放控制块
|
||||||
typedef struct audio_dev {
|
typedef struct audio_dev {
|
||||||
uint8_t *buff1;
|
uint8_t *buff[2];
|
||||||
uint8_t *buff2;
|
uint32_t buff_data_size[2]; //buff内数据长度
|
||||||
uint32_t buff1_data_size; //buff1内数据长度
|
uint32_t buff_size_max; //buff的大小
|
||||||
uint32_t buff2_data_size; //buff1内数据长度
|
uint8_t buff_using; //正在使用的buff
|
||||||
uint32_t buff_size_max; //buff的大小
|
|
||||||
uint8_t buff_using; //正在使用的buff
|
|
||||||
|
|
||||||
uint8_t audio_state; //状态
|
uint8_t audio_state; //状态
|
||||||
uint8_t audio_type; //类型
|
uint8_t audio_type; //类型
|
||||||
|
@ -55,50 +56,30 @@ int record_callback(audio_dev_t *audio_dev);
|
||||||
audio_dev_t Audio_Dev = { 0 };
|
audio_dev_t Audio_Dev = { 0 };
|
||||||
|
|
||||||
struct device *spi0;
|
struct device *spi0;
|
||||||
struct device *i2c0;
|
struct device *dma_ch2; /* spi tx */
|
||||||
struct device *uart0;
|
struct device *dma_ch3; /* spi rx */
|
||||||
struct device *dma_ch2; //uart tx
|
static ES8388_Cfg_Type ES8388Cfg = {
|
||||||
struct device *dma_ch3; //spi rx
|
.work_mode = ES8388_CODEC_MDOE, /*!< ES8388 work mode */
|
||||||
|
.role = ES8388_MASTER, /*!< ES8388 role */
|
||||||
|
.mic_input_mode = ES8388_DIFF_ENDED_MIC, /*!< ES8388 mic input mode */
|
||||||
|
.mic_pga = ES8388_MIC_PGA_3DB, /*!< ES8388 mic PGA */
|
||||||
|
.i2s_frame = ES8388_LEFT_JUSTIFY_FRAME, /*!< ES8388 I2S frame */
|
||||||
|
.data_width = ES8388_DATA_LEN_16, /*!< ES8388 I2S dataWitdh */
|
||||||
|
};
|
||||||
|
|
||||||
uint8_t buff1[2 * 1024] __attribute__((section(".system_ram"), aligned(4)));
|
uint8_t buff[2][2 * 1024] __attribute__((section(".system_ram"), aligned(4)));
|
||||||
uint8_t buff2[2 * 1024] __attribute__((section(".system_ram"), aligned(4)));
|
|
||||||
|
|
||||||
int record_callback(audio_dev_t *audio_dev);
|
int record_callback(audio_dev_t *audio_dev);
|
||||||
|
|
||||||
void dma_ch3_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
void dma_ch2_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
||||||
{
|
{
|
||||||
Audio_Dev.audio_callback(&Audio_Dev);
|
Audio_Dev.audio_callback(&Audio_Dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uart0_rx_irq_callback(struct device *dev, void *args, uint32_t size, uint32_t state)
|
|
||||||
{
|
|
||||||
if (state == UART_EVENT_RX_FIFO) {
|
|
||||||
if (memcmp((uint8_t *)args, "start record\r\n", 14) == 0) {
|
|
||||||
//MSG("start recording...\r\n");
|
|
||||||
Audio_Dev.audio_state = 1;
|
|
||||||
} else if (memcmp((uint8_t *)args, "stop record\r\n", 14) == 0) {
|
|
||||||
//MSG("stop recording...\r\n");
|
|
||||||
Audio_Dev.audio_state = 0;
|
|
||||||
} else {
|
|
||||||
//MSG("error code...\r\n");
|
|
||||||
}
|
|
||||||
} else if (state == UART_EVENT_RTO) {
|
|
||||||
if (memcmp((uint8_t *)args, "start record\r\n", 14) == 0) {
|
|
||||||
//MSG("start recording...\r\n");
|
|
||||||
Audio_Dev.audio_state = 1;
|
|
||||||
} else if (memcmp((uint8_t *)args, "stop record\r\n", 14) == 0) {
|
|
||||||
//MSG("stop recording...\r\n");
|
|
||||||
Audio_Dev.audio_state = 0;
|
|
||||||
} else {
|
|
||||||
//MSG("error code...\r\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t spi_init(void)
|
uint8_t spi_init(void)
|
||||||
{
|
{
|
||||||
spi_register(SPI0_INDEX, "spi0");
|
spi_register(SPI0_INDEX, "spi0");
|
||||||
dma_register(DMA0_CH3_INDEX, "ch3");
|
|
||||||
spi0 = device_find("spi0");
|
spi0 = device_find("spi0");
|
||||||
|
|
||||||
if (spi0) {
|
if (spi0) {
|
||||||
|
@ -110,11 +91,27 @@ uint8_t spi_init(void)
|
||||||
((spi_device_t *)spi0)->clk_phase = SPI_PHASE_1EDGE;
|
((spi_device_t *)spi0)->clk_phase = SPI_PHASE_1EDGE;
|
||||||
((spi_device_t *)spi0)->fifo_threshold = 2;
|
((spi_device_t *)spi0)->fifo_threshold = 2;
|
||||||
|
|
||||||
device_open(spi0, DEVICE_OFLAG_DMA_RX);
|
device_open(spi0, DEVICE_OFLAG_DMA_RX | DEVICE_OFLAG_DMA_TX);
|
||||||
}
|
}
|
||||||
|
|
||||||
dma_ch3 = device_find("ch3");
|
dma_register(DMA0_CH2_INDEX, "ch2");
|
||||||
|
dma_ch2 = device_find("ch2");
|
||||||
|
|
||||||
|
if (dma_ch2) {
|
||||||
|
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
||||||
|
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||||
|
((dma_device_t *)dma_ch2)->src_req = DMA_REQUEST_NONE;
|
||||||
|
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_SPI0_TX;
|
||||||
|
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
|
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
|
device_open(dma_ch2, 0);
|
||||||
|
device_set_callback(dma_ch2, dma_ch2_irq_callback);
|
||||||
|
device_control(dma_ch2, DEVICE_CTRL_SET_INT, NULL);
|
||||||
|
device_control(spi0, DEVICE_CTRL_ATTACH_TX_DMA, dma_ch2);
|
||||||
|
}
|
||||||
|
|
||||||
|
dma_register(DMA0_CH3_INDEX, "ch3");
|
||||||
|
dma_ch3 = device_find("ch3");
|
||||||
if (dma_ch3) {
|
if (dma_ch3) {
|
||||||
((dma_device_t *)dma_ch3)->direction = DMA_PERIPH_TO_MEMORY;
|
((dma_device_t *)dma_ch3)->direction = DMA_PERIPH_TO_MEMORY;
|
||||||
((dma_device_t *)dma_ch3)->transfer_mode = DMA_LLI_ONCE_MODE;
|
((dma_device_t *)dma_ch3)->transfer_mode = DMA_LLI_ONCE_MODE;
|
||||||
|
@ -123,7 +120,7 @@ uint8_t spi_init(void)
|
||||||
((dma_device_t *)dma_ch3)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
((dma_device_t *)dma_ch3)->src_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
((dma_device_t *)dma_ch3)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
((dma_device_t *)dma_ch3)->dst_width = DMA_TRANSFER_WIDTH_16BIT;
|
||||||
device_open(dma_ch3, 0);
|
device_open(dma_ch3, 0);
|
||||||
device_set_callback(dma_ch3, dma_ch3_irq_callback);
|
device_set_callback(dma_ch3, NULL);
|
||||||
device_control(dma_ch3, DEVICE_CTRL_SET_INT, NULL);
|
device_control(dma_ch3, DEVICE_CTRL_SET_INT, NULL);
|
||||||
device_control(spi0, DEVICE_CTRL_ATTACH_RX_DMA, dma_ch3);
|
device_control(spi0, DEVICE_CTRL_ATTACH_RX_DMA, dma_ch3);
|
||||||
}
|
}
|
||||||
|
@ -131,221 +128,93 @@ uint8_t spi_init(void)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uart_init(void)
|
|
||||||
{
|
|
||||||
dma_register(DMA0_CH2_INDEX, "ch2");
|
|
||||||
uart0 = device_find("debug_log");
|
|
||||||
|
|
||||||
if (uart0) {
|
|
||||||
device_close(uart0);
|
|
||||||
} else {
|
|
||||||
uart_register(UART0_INDEX, "debug_log");
|
|
||||||
}
|
|
||||||
|
|
||||||
uart0 = device_find("debug_log");
|
|
||||||
|
|
||||||
if (uart0) {
|
|
||||||
((uart_device_t *)uart0)->baudrate = 2000000;
|
|
||||||
((uart_device_t *)uart0)->fifo_threshold = 64;
|
|
||||||
device_open(uart0, DEVICE_OFLAG_DMA_TX | DEVICE_OFLAG_INT_RX);
|
|
||||||
device_set_callback(uart0, uart0_rx_irq_callback);
|
|
||||||
device_control(uart0, DEVICE_CTRL_SET_INT, (void *)(UART_RX_FIFO_IT | UART_RTO_IT));
|
|
||||||
}
|
|
||||||
|
|
||||||
dma_ch2 = device_find("ch2");
|
|
||||||
|
|
||||||
if (dma_ch2) {
|
|
||||||
((dma_device_t *)dma_ch2)->direction = DMA_MEMORY_TO_PERIPH;
|
|
||||||
((dma_device_t *)dma_ch2)->transfer_mode = DMA_LLI_ONCE_MODE;
|
|
||||||
((dma_device_t *)dma_ch2)->src_req = DMA_REQUEST_NONE;
|
|
||||||
((dma_device_t *)dma_ch2)->dst_req = DMA_REQUEST_UART0_TX;
|
|
||||||
((dma_device_t *)dma_ch2)->src_width = DMA_TRANSFER_WIDTH_8BIT;
|
|
||||||
((dma_device_t *)dma_ch2)->dst_width = DMA_TRANSFER_WIDTH_8BIT;
|
|
||||||
device_open(dma_ch2, 0);
|
|
||||||
device_set_callback(dma_ch2, NULL);
|
|
||||||
device_control(dma_ch2, DEVICE_CTRL_CLR_INT, NULL);
|
|
||||||
|
|
||||||
device_control(uart0, DEVICE_CTRL_ATTACH_TX_DMA, dma_ch2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void i2c_init(void)
|
|
||||||
{
|
|
||||||
i2c_register(I2C0_INDEX, "i2c");
|
|
||||||
i2c0 = device_find("i2c");
|
|
||||||
|
|
||||||
if (i2c0) {
|
|
||||||
((i2c_device_t *)i2c0)->id = 0;
|
|
||||||
((i2c_device_t *)i2c0)->mode = I2C_HW_MODE;
|
|
||||||
((i2c_device_t *)i2c0)->phase = 15;
|
|
||||||
device_open(i2c0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int es8374_write_reg(uint8_t addr, uint8_t data)
|
|
||||||
{
|
|
||||||
i2c_msg_t msg1;
|
|
||||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
|
||||||
msg1.len = 1,
|
|
||||||
msg1.buf = &data;
|
|
||||||
msg1.flags = SUB_ADDR_1BYTE | I2C_WR;
|
|
||||||
msg1.subaddr = addr;
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
return i2c_transfer(i2c0, &msg1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
BL_Err_Type es8388_read_reg(uint8_t addr, uint8_t *rdata)
|
|
||||||
{
|
|
||||||
i2c_msg_t msg1;
|
|
||||||
msg1.len = 1,
|
|
||||||
msg1.buf = rdata;
|
|
||||||
msg1.subaddr = addr;
|
|
||||||
msg1.slaveaddr = ES8374_SLAVE_ADDR,
|
|
||||||
msg1.flags = SUB_ADDR_1BYTE | I2C_RD;
|
|
||||||
return i2c_transfer(i2c0, &msg1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t es8374_config_master(void)
|
|
||||||
{
|
|
||||||
es8374_write_reg(0x00, 0x3F);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x00, 0x03);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x01, 0x7F);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x05, 0x11);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x6F, 0xA0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x72, 0x41);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x09, 0x01);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0C, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0D, 0x13);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0E, 0xE0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0A, 0x3A);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x0B, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x09, 0x41);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x24, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x36, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x12, 0x30);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x13, 0x20);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x21, 0x50);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x22, 0x55);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x21, 0x24);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x00, 0x80);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x14, 0x8A);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x15, 0x40);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1A, 0xA0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1B, 0x19);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1C, 0x90);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1D, 0x2B);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1F, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x1E, 0xA0);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x28, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x25, 0x1F);
|
|
||||||
bflb_platform_delay_ms(10); //增益
|
|
||||||
es8374_write_reg(0x38, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x37, 0x00);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x6D, 0x60);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x03, 0x20);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x06, 0x03);
|
|
||||||
bflb_platform_delay_ms(10); // 0x0600 ---8K sample. 0x100 48k
|
|
||||||
es8374_write_reg(0x07, 0x00);
|
|
||||||
bflb_platform_delay_ms(10); //
|
|
||||||
es8374_write_reg(0x0F, 0x95);
|
|
||||||
bflb_platform_delay_ms(10); //0x9D 8K 0x95 16K
|
|
||||||
es8374_write_reg(0x10, 0x0D);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x11, 0x0D);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
es8374_write_reg(0x02, 0x08);
|
|
||||||
bflb_platform_delay_ms(10);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t es8374_config_dump(void)
|
|
||||||
{
|
|
||||||
uint8_t i = 0;
|
|
||||||
uint8_t val = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < 0X6D; i++) {
|
|
||||||
es8388_read_reg(i, &val);
|
|
||||||
MSG("0x%x = 0x%x\r\n", i, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int record_init(audio_dev_t *audio_dev)
|
int record_init(audio_dev_t *audio_dev)
|
||||||
{
|
{
|
||||||
audio_dev->buff1 = buff1;
|
GLB_GPIO_Cfg_Type gpio_cfg = {
|
||||||
audio_dev->buff2 = buff2;
|
.drive = 0,
|
||||||
audio_dev->buff_size_max = sizeof(buff1);
|
.smtCtrl = 1,
|
||||||
|
.gpioMode = GPIO_MODE_AF,
|
||||||
|
.pullType = GPIO_PULL_UP,
|
||||||
|
.gpioPin = SPI0_CS,
|
||||||
|
.gpioFun = GPIO_FUN_UNUSED,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* audio结构体填充*/
|
||||||
|
Audio_Dev.audio_callback = record_callback;
|
||||||
|
audio_dev->buff[0] = buff[0];
|
||||||
|
audio_dev->buff[1] = buff[1];
|
||||||
|
audio_dev->buff_size_max = sizeof(buff) / 2;
|
||||||
|
|
||||||
|
memset(audio_dev->buff[0], 0xF0, sizeof(buff) / 2);
|
||||||
|
memset(audio_dev->buff[1], 0xF0, sizeof(buff) / 2);
|
||||||
|
|
||||||
audio_dev->audio_state = 0;
|
audio_dev->audio_state = 0;
|
||||||
audio_dev->audio_init = record_init;
|
audio_dev->buff_using = 0;
|
||||||
audio_dev->audio_callback = record_callback;
|
|
||||||
|
|
||||||
i2c_init();
|
|
||||||
uart_init();
|
|
||||||
es8374_config_master();
|
|
||||||
//es8374_config_dump();
|
|
||||||
|
|
||||||
|
/* 初始化SPI和DMA */
|
||||||
spi_init();
|
spi_init();
|
||||||
|
|
||||||
device_read(spi0, 0, audio_dev->buff1, audio_dev->buff_size_max);
|
// /* 取消DMA方式发送 */
|
||||||
audio_dev->buff_using = 1;
|
// device_control(spi0, DEVICE_CTRL_TX_DMA_SUSPEND, NULL);
|
||||||
|
// /* 向FIFO里填几个数据,以下两种方式都行,第一种会因为发送超时结束,第二种直接填FIFO。不这样后面就会出错,原因不明 */
|
||||||
|
// //spi_transmit(spi0, test_buf, 4, 1);
|
||||||
|
|
||||||
|
// for (uint8_t i = 0; i < 4; i++) {
|
||||||
|
// BL_WR_REG(SPI_BASE, SPI_FIFO_WDATA, 0xFF00);
|
||||||
|
// }
|
||||||
|
// /* 恢复DMA方式发送 */
|
||||||
|
// device_control(spi0, DEVICE_CTRL_TX_DMA_RESUME, NULL);
|
||||||
|
|
||||||
|
/* output MCLK */
|
||||||
|
GLB_Set_Chip_Out_0_CLK_Sel(GLB_CHIP_CLK_OUT_I2S_REF_CLK);
|
||||||
|
GLB_Set_I2S_CLK(ENABLE, GLB_I2S_OUT_REF_CLK_NONE);
|
||||||
|
|
||||||
|
/* init ES8388 Codec */
|
||||||
|
ES8388_Init(&ES8388Cfg);
|
||||||
|
ES8388_Set_Voice_Volume(10);
|
||||||
|
|
||||||
|
// /* FS复用成普通GPIO的 输入模式 */
|
||||||
|
// gpio_cfg.gpioFun = GPIO_FUN_UNUSED;
|
||||||
|
// GLB_GPIO_Init(&gpio_cfg);
|
||||||
|
// gpio_set_mode(SPI0_CS, GPIO_INPUT_PP_MODE);
|
||||||
|
|
||||||
|
// // /* 先关SPI*/
|
||||||
|
// device_control(spi0, DEVICE_CTRL_SUSPEND, NULL);
|
||||||
|
/* 让SPI-DMA数据发送准备就绪 */
|
||||||
|
device_write(spi0, 0, audio_dev->buff[1], audio_dev->buff_size_max);
|
||||||
|
|
||||||
|
// /* 等待FS(CS)低电平 */
|
||||||
|
// while (gpio_read(SPI0_CS)) {
|
||||||
|
// };
|
||||||
|
// /* 等待FS(CS)上升沿 */
|
||||||
|
// while (!gpio_read(SPI0_CS)) {
|
||||||
|
// };
|
||||||
|
|
||||||
|
// /* 重新复用位SPI-CS功能 */
|
||||||
|
// gpio_cfg.gpioFun = GPIO_FUN_SPI;
|
||||||
|
// GLB_GPIO_Init(&gpio_cfg);
|
||||||
|
|
||||||
|
// /* 确认同步后再启动SPI */
|
||||||
|
// MSG(" SPI");
|
||||||
|
// device_control(spi0, DEVICE_CTRL_RESUME, NULL);
|
||||||
|
// MSG(" OK\r\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int record_callback(audio_dev_t *audio_dev)
|
int record_callback(audio_dev_t *audio_dev)
|
||||||
{
|
{
|
||||||
if (audio_dev->buff_using == 1) {
|
MSG("init %d\r\n", audio_dev->buff_using);
|
||||||
device_read(spi0, 0, audio_dev->buff2, audio_dev->buff_size_max);
|
|
||||||
|
|
||||||
if (audio_dev->audio_state) {
|
device_write(spi0, 0, audio_dev->buff[audio_dev->buff_using], audio_dev->buff_size_max);
|
||||||
device_write(uart0, 0, audio_dev->buff1, audio_dev->buff_size_max);
|
|
||||||
}
|
|
||||||
|
|
||||||
audio_dev->buff_using = 2;
|
audio_dev->buff_using = !audio_dev->buff_using;
|
||||||
} else if (audio_dev->buff_using == 2) {
|
|
||||||
device_read(spi0, 0, audio_dev->buff1, audio_dev->buff_size_max);
|
|
||||||
|
|
||||||
if (audio_dev->audio_state) {
|
device_read(spi0, 0, audio_dev->buff[audio_dev->buff_using], audio_dev->buff_size_max);
|
||||||
device_write(uart0, 0, audio_dev->buff2, audio_dev->buff_size_max);
|
|
||||||
}
|
|
||||||
|
|
||||||
audio_dev->buff_using = 1;
|
for (uint8_t i = 0; i < 20; i++)
|
||||||
}
|
MSG("%x ", audio_dev->buff[audio_dev->buff_using][i + 100]);
|
||||||
|
MSG("\r\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ int main(void)
|
||||||
MSG("%s", str);
|
MSG("%s", str);
|
||||||
|
|
||||||
while (lcd_draw_is_busy()) {
|
while (lcd_draw_is_busy()) {
|
||||||
BL_DRV_DUMMY;
|
__ASM volatile("nop");
|
||||||
}
|
}
|
||||||
lcd_draw_str_ascii16(5, 180, 0xFFFF, 0x0010, str, 0xff);
|
lcd_draw_str_ascii16(5, 180, 0xFFFF, 0x0010, str, 0xff);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
```bash
|
```bash
|
||||||
|
|
||||||
$ make APP=spi_ssd1306_badapple BOARD=bl706_avb
|
$ make APP=spi_oled_badapple BOARD=bl706_avb
|
||||||
|
|
||||||
```
|
```
|
|
@ -60,14 +60,18 @@ SECTIONS
|
||||||
*(.text.*)
|
*(.text.*)
|
||||||
|
|
||||||
/*put .rodata**/
|
/*put .rodata**/
|
||||||
*(EXCLUDE_FILE( *bl702_glb.o \
|
*(EXCLUDE_FILE( *bl702_glb*.o* \
|
||||||
*bl702_pds.o \
|
*bl702_pds*.o* \
|
||||||
*bl702_common.o \
|
*bl702_common*.o* \
|
||||||
*bl702_sf_cfg.o \
|
*bl702_sf_cfg*.o* \
|
||||||
*bl702_sf_ctrl.o \
|
*bl702_sf_cfg_ext*.o* \
|
||||||
*bl702_sflash.o \
|
*bl702_sf_ctrl*.o* \
|
||||||
*bl702_xip_sflash.o \
|
*bl702_sflash*.o* \
|
||||||
*bl702_ef_ctrl.o) .rodata*)
|
*bl702_sflash_ext*.o* \
|
||||||
|
*bl702_xip_sflash*.o* \
|
||||||
|
*bl702_xip_sflash_ext*.o* \
|
||||||
|
*bl702_ef_ctrl*.o*) .rodata*)
|
||||||
|
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
|
|
||||||
|
@ -86,19 +90,22 @@ SECTIONS
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_start__ = .;
|
__tcm_code_start__ = .;
|
||||||
|
|
||||||
*(.tcm_code)
|
*(.tcm_code.*)
|
||||||
*(.tcm_const)
|
*(.tcm_const.*)
|
||||||
*(.sclock_rlt_code)
|
*(.sclock_rlt_code.*)
|
||||||
*(.sclock_rlt_const)
|
*(.sclock_rlt_const.*)
|
||||||
|
|
||||||
*bl702_glb.o*(.rodata*)
|
*bl702_glb*.o*(.rodata*)
|
||||||
*bl702_pds.o*(.rodata*)
|
*bl702_pds*.o*(.rodata*)
|
||||||
*bl702_common.o*(.rodata*)
|
*bl702_common*.o*(.rodata*)
|
||||||
*bl702_sf_cfg.o*(.rodata*)
|
*bl702_sf_cfg*.o*(.rodata*)
|
||||||
*bl702_sf_ctrl.o*(.rodata*)
|
*bl702_sf_cfg_ext*.o*(.rodata*)
|
||||||
*bl702_sflash.o*(.rodata*)
|
*bl702_sf_ctrl*.o*(.rodata*)
|
||||||
*bl702_xip_sflash.o*(.rodata*)
|
*bl702_sflash*.o*(.rodata*)
|
||||||
*bl702_ef_ctrl.o*(.rodata*)
|
*bl702_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_ef_ctrl*.o*(.rodata*)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_end__ = .;
|
__tcm_code_end__ = .;
|
||||||
|
|
|
@ -60,14 +60,18 @@ SECTIONS
|
||||||
*(.text.*)
|
*(.text.*)
|
||||||
|
|
||||||
/*put .rodata**/
|
/*put .rodata**/
|
||||||
*(EXCLUDE_FILE( *bl702_glb.o \
|
*(EXCLUDE_FILE( *bl702_glb*.o* \
|
||||||
*bl702_pds.o \
|
*bl702_pds*.o* \
|
||||||
*bl702_common.o \
|
*bl702_common*.o* \
|
||||||
*bl702_sf_cfg.o \
|
*bl702_sf_cfg*.o* \
|
||||||
*bl702_sf_ctrl.o \
|
*bl702_sf_cfg_ext*.o* \
|
||||||
*bl702_sflash.o \
|
*bl702_sf_ctrl*.o* \
|
||||||
*bl702_xip_sflash.o \
|
*bl702_sflash*.o* \
|
||||||
*bl702_ef_ctrl.o) .rodata*)
|
*bl702_sflash_ext*.o* \
|
||||||
|
*bl702_xip_sflash*.o* \
|
||||||
|
*bl702_xip_sflash_ext*.o* \
|
||||||
|
*bl702_ef_ctrl*.o*) .rodata*)
|
||||||
|
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
|
|
||||||
|
@ -86,19 +90,22 @@ SECTIONS
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_start__ = .;
|
__tcm_code_start__ = .;
|
||||||
|
|
||||||
*(.tcm_code)
|
*(.tcm_code.*)
|
||||||
*(.tcm_const)
|
*(.tcm_const.*)
|
||||||
*(.sclock_rlt_code)
|
*(.sclock_rlt_code.*)
|
||||||
*(.sclock_rlt_const)
|
*(.sclock_rlt_const.*)
|
||||||
|
|
||||||
*bl702_glb.o*(.rodata*)
|
*bl702_glb*.o*(.rodata*)
|
||||||
*bl702_pds.o*(.rodata*)
|
*bl702_pds*.o*(.rodata*)
|
||||||
*bl702_common.o*(.rodata*)
|
*bl702_common*.o*(.rodata*)
|
||||||
*bl702_sf_cfg.o*(.rodata*)
|
*bl702_sf_cfg*.o*(.rodata*)
|
||||||
*bl702_sf_ctrl.o*(.rodata*)
|
*bl702_sf_cfg_ext*.o*(.rodata*)
|
||||||
*bl702_sflash.o*(.rodata*)
|
*bl702_sf_ctrl*.o*(.rodata*)
|
||||||
*bl702_xip_sflash.o*(.rodata*)
|
*bl702_sflash*.o*(.rodata*)
|
||||||
*bl702_ef_ctrl.o*(.rodata*)
|
*bl702_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_ef_ctrl*.o*(.rodata*)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_end__ = .;
|
__tcm_code_end__ = .;
|
||||||
|
|
|
@ -55,14 +55,18 @@ SECTIONS
|
||||||
*(.text.*)
|
*(.text.*)
|
||||||
|
|
||||||
/*put .rodata**/
|
/*put .rodata**/
|
||||||
*(EXCLUDE_FILE( *bl702_glb.o \
|
*(EXCLUDE_FILE( *bl702_glb*.o* \
|
||||||
*bl702_pds.o \
|
*bl702_pds*.o* \
|
||||||
*bl702_common.o \
|
*bl702_common*.o* \
|
||||||
*bl702_sf_cfg.o \
|
*bl702_sf_cfg*.o* \
|
||||||
*bl702_sf_ctrl.o \
|
*bl702_sf_cfg_ext*.o* \
|
||||||
*bl702_sflash.o \
|
*bl702_sf_ctrl*.o* \
|
||||||
*bl702_xip_sflash.o \
|
*bl702_sflash*.o* \
|
||||||
*bl702_ef_ctrl.o) .rodata*)
|
*bl702_sflash_ext*.o* \
|
||||||
|
*bl702_xip_sflash*.o* \
|
||||||
|
*bl702_xip_sflash_ext*.o* \
|
||||||
|
*bl702_ef_ctrl*.o*) .rodata*)
|
||||||
|
|
||||||
*(.rodata)
|
*(.rodata)
|
||||||
*(.rodata.*)
|
*(.rodata.*)
|
||||||
|
|
||||||
|
@ -81,19 +85,22 @@ SECTIONS
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_start__ = .;
|
__tcm_code_start__ = .;
|
||||||
|
|
||||||
*(.tcm_code)
|
*(.tcm_code.*)
|
||||||
*(.tcm_const)
|
*(.tcm_const.*)
|
||||||
*(.sclock_rlt_code)
|
*(.sclock_rlt_code.*)
|
||||||
*(.sclock_rlt_const)
|
*(.sclock_rlt_const.*)
|
||||||
|
|
||||||
*bl702_glb.o*(.rodata*)
|
*bl702_glb*.o*(.rodata*)
|
||||||
*bl702_pds.o*(.rodata*)
|
*bl702_pds*.o*(.rodata*)
|
||||||
*bl702_common.o*(.rodata*)
|
*bl702_common*.o*(.rodata*)
|
||||||
*bl702_sf_cfg.o*(.rodata*)
|
*bl702_sf_cfg*.o*(.rodata*)
|
||||||
*bl702_sf_ctrl.o*(.rodata*)
|
*bl702_sf_cfg_ext*.o*(.rodata*)
|
||||||
*bl702_sflash.o*(.rodata*)
|
*bl702_sf_ctrl*.o*(.rodata*)
|
||||||
*bl702_xip_sflash.o*(.rodata*)
|
*bl702_sflash*.o*(.rodata*)
|
||||||
*bl702_ef_ctrl.o*(.rodata*)
|
*bl702_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash*.o*(.rodata*)
|
||||||
|
*bl702_xip_sflash_ext*.o*(.rodata*)
|
||||||
|
*bl702_ef_ctrl*.o*(.rodata*)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__tcm_code_end__ = .;
|
__tcm_code_end__ = .;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue