Skip to content

BetterOIer/RCProjects

Repository files navigation

Zephyr RTOS 下位机框架

该项目希望以设备树形式描述机器人

最终的效果将如example.dts所示

The structure is as shown below structure

如何在我的开发板上运行?(以Robomaster Developement Board C为例)

Initialization

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

You should have a virtual environment if Python tells you to do so

可以提前更换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/simple
pip install west

Then 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 update

Then 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-eabi

Building and running

To 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.d

Then, ask the udev daemon to reload these rules:

sudo udevadm control --reload

Unplug 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 
                            |、˜ 〵 
                            じしˍ,_)ノ

About

Forked from SUSTech ARES

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors