The structure is as shown below
First zephyr SDKs are needed.
sudo apt update
sudo apt upgrade
sudo apt install --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1可以提前更换PIP源:
pip install --upgrade pip --index-url https://mirrors.sustech.edu.cn/pypi/web/simple
pip config set global.index-url https://mirrors.sustech.edu.cn/pypi/web/simplepip install westThen initialize the workspace folder (my-workspace) where
the example-application and all Zephyr modules will be cloned. Run the following
command:
# initialize my-workspace for the example-application (main branch)
west init -m https://mirrors.sustech.edu.cn/git/12411711/mambo --mr master my-workspace
# update Zephyr modules
cd my-workspace
west updateThen export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications.
west zephyr-export
pip install -r ./zephyr/scripts/requirements.txt
west sdk install -t arm-zephyr-eabiTo build the application, run the following command:
cd mambo
west build -b robomaster_board_c samples/motor/dji_m3508_demo$BOARD is the target board. Here you can use robomaster_board_c
A sample debug configuration is also provided. To apply it, run the following command:
Once you have built the application, run the following command to flash it:
west flash默认为cmsis-dap, 如果使用stlink请加上--runner stlink, Jlink则为--runner jlink
If everything goes well, the LED on the board should be blinking
Then you can have your motors running!
另外,VSC_sample_configs下有.vscode的示例配置文件
详细的文档请参考Documents文件夹
如果flash时提示找不到compatible CMSIS_DAP device, 参照以下做法: Flashing a board requires permission to directly access the board hardware, usually managed by installation of the flashing tools. On Linux systems, if the west flash command fails, you likely need to define udev rules to grant the needed access permission.
Udev is a device manager for the Linux kernel and the udev daemon handles all user space events raised when a hardware device is added (or removed) from the system. We can add a rules file to grant access permission by non-root users to certain USB-connected devices.
The OpenOCD (On-Chip Debugger) project conveniently provides a rules file that defined board-specific rules for most Zephyr-supported arm-based boards, so we recommend installing this rules file by downloading it from their sourceforge repo, or if you’ve installed the Zephyr SDK there is a copy of this rules file in the SDK folder:
copy the rules file from the Zephyr SDK folder:
sudo cp ~/zephyr-sdk-*/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.dThen, ask the udev daemon to reload these rules:
sudo udevadm control --reloadUnplug and plug in the USB connection to your board, and you should have permission to access the board hardware for flashing. Check your board-specific documentation (Supported Boards and Shields) for further information if needed.
好无聊逗逗梅总吧
嘬嘬嘬𐃆 ˒˒ ͏
͏
͏ ╱|、
(˚ˎ 。7
|、˜ 〵
じしˍ,_)ノ
