-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
87 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,145 @@ | ||
# Hello_NuMaker-M032BTAI | ||
|
||
## Prerequisites | ||
## TL;DR | ||
|
||
Before proceeding with the commands, ensure you have the following | ||
installed: | ||
This repository demonstrates how to develop projects for the | ||
`NuMaker-M032BTAI` using `gcc-arm-none-eabi` with a `makefile`. | ||
|
||
- `make` | ||
- `gcc-arm-none-eabi` or `docker` | ||
- `Python 3.7+` and `pip` (for flashing and debugging) | ||
We use `pyOCD` for flashing and debugging because `OpenOCD` does not | ||
fully support the `NuMaker-M032BTAI`. | ||
|
||
## Quick Commands | ||
The example used is | ||
[SampleCode/NuMaker-M03xBT/BLE/Demo/Central/TRSP_UART_Central](https://github.com/OpenNuvoton/M031BSP/tree/master/SampleCode/NuMaker-M03xBT/BLE/Demo/Central/TRSP_UART_Central). | ||
|
||
The following quick commands are available for convenience: | ||
Use `make help` to quickly see available commands. | ||
|
||
- `make upgrade`: Executes `make clean`, `make`, and `make flash` | ||
sequentially. | ||
## Requirements | ||
|
||
## Building the Firmware | ||
Before proceeding with the commands, ensure you have the following | ||
installed: | ||
|
||
### Using Makefile | ||
- Required | ||
- `make` | ||
- `gcc-arm-none-eabi 13.2.Rel1+` or `docker` | ||
- Optional | ||
- To install `pyOCD`: | ||
1. Install `Python 3.7+` and `pip` | ||
2. Use `make install` to install `pyOCD` and required setup | ||
- To build documentation: | ||
1. Install `node.js 18+` and `npm` | ||
2. Install `pandoc` and `tinytex` | ||
3. Use `make docs-install` to install required extensions | ||
|
||
### Windows | ||
|
||
``` powershell | ||
choco install -y make gcc-arm-embedded python3 nodejs-lts pandoc tinytex | ||
``` | ||
|
||
To build the firmware using Makefile, run: | ||
### Linux / macOS | ||
|
||
``` bash | ||
make clean && make | ||
# Linux | ||
sudo apt update && sudo apt install -y curl git | ||
``` | ||
|
||
or build the firmware using Docker: | ||
|
||
``` bash | ||
make update && make docker | ||
# macOS | ||
brew install coreutils curl git | ||
``` | ||
|
||
## Flashing the Firmware | ||
|
||
We use [pyOCD](https://pypi.org/project/pyocd/) for cross-platform | ||
compatibility and to support the latest versions. | ||
[OpenOCD](https://github.com/OpenNuvoton/OpenOCD-Nuvoton) is not used in | ||
this process. | ||
|
||
### Installing pyOCD | ||
|
||
First, install `pyOCD` using `pip`: | ||
|
||
``` bash | ||
python -m pip install -U pyocd | ||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0 | ||
echo ". $HOME/.asdf/asdf.sh" >> ~/.bashrc | ||
echo ". $HOME/.asdf/completions/asdf.bash" >> ~/.bashrc | ||
source ~/.bashrc | ||
``` | ||
|
||
### Installing the Required Pack | ||
``` bash | ||
asdf plugin add make | ||
asdf plugin add gcc-arm-none-eabi | ||
asdf plugin add python | ||
asdf plugin add nodejs | ||
asdf plugin add pandoc | ||
asdf plugin add tinytex | ||
``` | ||
|
||
Next, install the pack for the target MCU: | ||
``` bash | ||
asdf install make latest | ||
asdf install gcc-arm-none-eabi latest | ||
asdf install python latest | ||
asdf install nodejs 18.18.0 | ||
asdf install pandoc latest | ||
asdf install tinytex latest | ||
``` | ||
|
||
``` bash | ||
pyocd pack install M032BTAIAAN | ||
asdf global make latest | ||
asdf global gcc-arm-none-eabi latest | ||
asdf global python latest | ||
asdf global nodejs 18.18.0 | ||
asdf global pandoc latest | ||
asdf global tinytex latest | ||
``` | ||
|
||
### Flashing the MCU | ||
## Quick Start | ||
|
||
Finally, flash the MCU with the following command: | ||
- Compile | ||
|
||
``` bash | ||
make flash | ||
make | ||
``` | ||
|
||
## Debugging the Firmware | ||
- Recompile | ||
|
||
To debug the firmware manually, use the following commands: | ||
``` bash | ||
make clean && make | ||
``` | ||
|
||
### Starting the GDB Server | ||
``` bash | ||
make rebuild | ||
``` | ||
|
||
Start the GDB server with `pyOCD`: | ||
- Flash | ||
|
||
``` bash | ||
pyocd gdbserver -t M032BTAIAAN --elf Source\build\TRSP_UART_Central.elf | ||
make flash | ||
``` | ||
|
||
### Connecting GDB to the Target | ||
|
||
In the GDB command line, connect to the target and load the firmware: | ||
- Recompile and Flash | ||
|
||
``` bash | ||
(gdb) target remote localhost:3333 | ||
(gdb) monitor reset halt | ||
(gdb) load | ||
make upgrade | ||
``` | ||
|
||
## Documentation | ||
|
||
To build the documentation, run: | ||
- Generate Documentation | ||
|
||
``` bash | ||
make docs | ||
``` | ||
|
||
### You need to install these software first | ||
## Debugging with `pyOCD` | ||
|
||
- On Windows: | ||
To debug the firmware manually, use the following commands: | ||
|
||
``` bash | ||
choco install -y pandoc miktex | ||
``` | ||
### Starting the GDB Server | ||
|
||
- On macOS: | ||
Start the GDB server with `pyOCD`: | ||
|
||
``` bash | ||
brew install pandoc | ||
brew install --cask mactex-no-gui | ||
pyocd gdbserver -t M032BTAIAAN --elf Source\build\TRSP_UART_Central.elf | ||
``` | ||
|
||
- On Linux: | ||
### Connecting GDB to the Target | ||
|
||
In the GDB command line, connect to the target and load the firmware: | ||
|
||
``` bash | ||
sudo apt-get update && sudo apt-get install -y pandoc texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra | ||
(gdb) target remote localhost:3333 | ||
(gdb) monitor reset halt | ||
(gdb) load | ||
``` | ||
|
||
- Then, install the required extensions: | ||
## More Information | ||
|
||
``` bash | ||
make docs-install | ||
``` | ||
- [OpenNuvoton/M031BSP](https://github.com/OpenNuvoton/M031BSP) |
Binary file not shown.