sipeed / M1s_BL808_example

M1s_BL808_example
Apache License 2.0
66 stars 14 forks source link

[Info] Enable LP core and receive HelloWorld msg from LP core. #13

Closed cjacker closed 1 year ago

cjacker commented 1 year ago

Update: Already upstreamed.

Install XuanTie RISC-V toolchain

wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142243961/Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1-20220906.tar.gz
sudo mkdir -p /opt/xuantie-riscv64-embed-toolchain
sudo tar xf Xuantie-900-gcc-elf-newlib-x86_64-V2.6.1-20220906.tar.gz -C /opt/xuantie-riscv64-embed-toolchain --strip-components=1

And add /opt/xuantie-riscv64-embed-toolchain/bin to PATH env according to your shell.

Apply patch to bl_mcu_sdk

Update already upstreamed

Build this triplecore demo

Enter 'bl_mcu_sdk/examples/bl808_triplecore', and type 'make'

After build successfully, these firmware files will be generated:

Program to bl808

Since BLDevCube GUI tool not support Group2 in BL808 MCU page, you can not program these firmwares in one time.

I suggest to program it one by one by BLFlashCommand, you may need to activate UART programming mode every time.

Here use Sipeed M1S Dock as example.

M1S Dock will enter UART programming mode.

Then:

cd helloworld_m0
make flash BL_SDK_BASE=$(HOME)/bl_mcu_sdk

After programmed, you need re-power M1S Dock and continue programming firmwares for d0 and lp core as above steps.

Wire up USB2TTL adapters

After all three firmware programmed, Wire 3 USB2TTL adapter as:

For M1S Dock, since it already have 2 UARTs connect to D0 and M0, you only need wire another USB2TTL adapter to GPIO 18 and GPIO 19 for LP core.

For my env, the 3 serial devices are :

Check it according to your env.

Receive hello world from 3 cores

Use any serial terminal such as tio / minicom / picocom / cutecom, etc. Set baudrate to 2000000, 8N1, and open 3 serial devices.

You will receive "hello world" from 3 cores.

To restore factory firmwares for Sipeed M1S Dock

Use these scripts and firmware to restore the factory firmwares for Sipeed M1S Dock:

https://github.com/cjacker/opensource-toolchain-bouffalo-lab/tree/main/m1s_dock_factory_firmware

More

taorye commented 1 year ago

Nice Try!