Getting started with zephyr on DA1469x: Difference between revisions

From Renesas.info
(Added installation)
(Removed switching to dev branch, added sleep configuration)
 
(8 intermediate revisions by the same user not shown)
Line 3: Line 3:


Please note that micropython does NOT support building on windows. Windows users that want to build micropython should use WSL. A known issue with WSL is poor USB support, so that will complicate flashing hardware.
Please note that micropython does NOT support building on windows. Windows users that want to build micropython should use WSL. A known issue with WSL is poor USB support, so that will complicate flashing hardware.
== Testing on hardware ==
With the toolchain installed it's time to try flashing the board with a Zephyr program. The classic first project is blinky.
First, open a terminal in the zephyr folder under ~/zephyrproject(the folder you specified in west init) and build blinky.
<code>west build -p auto -b da1469x_dk_pro .\samples\basic\blinky\</code> on Windows
or
<code>west build -p auto -b da1469x_dk_pro ./samples/basic/blinky/</code> on Linux
After a successfull build, the board can be flashed by running <code>west flash</code> . This command runs EzFlashCLI to program the binary to flash. As EzFlashCLI isn't in requirements.txt yet, it may throw an error like EzFlashCLI not found. It can be installed using pip (when using WSL, make sure to install it on your Windows installation too): <code>pip install ezflashcli</code><blockquote>Note for WSL users: if west flash fails to find the JLink device, it's possible to invoke powershell commands from WSL. The command to flash from WSL would be <code>powershell.exe ezflashcli image_flash ./build/zephyr/zephyr.bin</code></blockquote>Right now the LED on the devkit should be blinking, If it didn't start blinking you may have to hit the reset button.
With the toolchain working we can move onto BLE. Building images with BLE needs the CMAC library, this is distributed as a binary blob in the Zephyhr HAL repos. By default these are not downloaded, you can download the library by running <code>west blobs fetch hal_renesas</code>. Skipping this step will result in an error like <code>ninja: error: '*/zephyrproject/modules/hal/renesas/zephyr/blobs/smartbond/cmac/libcmac/libcmac.a', needed by 'zephyr/zephyr_pre0.elf', missing and no known rule to make it</code>
Now we are ready to compile the first BLE example, which is very simple, just substitute the path to blinky with the path to a bluetooth example: <code>west build -p auto -b da1469x_dk_pro ./samples/bluetooth/peripheral/</code> This can be flashed using <code>west flash</code> too. If everything went well, you should have BLE peripheral running. This can be validated with any BLE scanning app.
==Enabling sleep==
By default, Zephyr doesn't use one of the best features of the DA1469x devices: sleep. Thankfully the Kconfig system allows us to enable sleep easily. Simply add these lines:<blockquote>CONFIG_PM=y
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_PM_DEVICE=y
CONFIG_REGULATOR=y</blockquote>To the prj.conf file of the example you're building.
==Compiling Micropython==
Compiling Micropython for any board supported by Zephyr is remarkably easy(Do note windows isn't supported). Just clone the Micropython repo and build the embedded Zephyr project. The suggested place to clone Micropython is in the zephyrproject folder.
<code>git clone -b micropython-demo-2023 <nowiki>https://github.com/dialog-semiconductor/micropython.git</nowiki></code>
This is the public facing repo which contains board support files that have not been merged into main yet.
With the Micropython repo cloned you are ready to build and flash:
<code>west build -p auto -b da1469x_dk_pro ../micropython/ports/zephyr/</code>
<code>west flash</code>
After flashing the board is reset and micropython is running. The Micropython REPL can be used over the serial port of the devkit.

Latest revision as of 13:27, 17 May 2024

Installing the toolchain

The process to install Zephyr is described in the zephyr docs.

Please note that micropython does NOT support building on windows. Windows users that want to build micropython should use WSL. A known issue with WSL is poor USB support, so that will complicate flashing hardware.

Testing on hardware

With the toolchain installed it's time to try flashing the board with a Zephyr program. The classic first project is blinky.

First, open a terminal in the zephyr folder under ~/zephyrproject(the folder you specified in west init) and build blinky.

west build -p auto -b da1469x_dk_pro .\samples\basic\blinky\ on Windows

or

west build -p auto -b da1469x_dk_pro ./samples/basic/blinky/ on Linux

After a successfull build, the board can be flashed by running west flash . This command runs EzFlashCLI to program the binary to flash. As EzFlashCLI isn't in requirements.txt yet, it may throw an error like EzFlashCLI not found. It can be installed using pip (when using WSL, make sure to install it on your Windows installation too): pip install ezflashcli

Note for WSL users: if west flash fails to find the JLink device, it's possible to invoke powershell commands from WSL. The command to flash from WSL would be powershell.exe ezflashcli image_flash ./build/zephyr/zephyr.bin

Right now the LED on the devkit should be blinking, If it didn't start blinking you may have to hit the reset button.

With the toolchain working we can move onto BLE. Building images with BLE needs the CMAC library, this is distributed as a binary blob in the Zephyhr HAL repos. By default these are not downloaded, you can download the library by running west blobs fetch hal_renesas. Skipping this step will result in an error like ninja: error: '*/zephyrproject/modules/hal/renesas/zephyr/blobs/smartbond/cmac/libcmac/libcmac.a', needed by 'zephyr/zephyr_pre0.elf', missing and no known rule to make it

Now we are ready to compile the first BLE example, which is very simple, just substitute the path to blinky with the path to a bluetooth example: west build -p auto -b da1469x_dk_pro ./samples/bluetooth/peripheral/ This can be flashed using west flash too. If everything went well, you should have BLE peripheral running. This can be validated with any BLE scanning app.

Enabling sleep

By default, Zephyr doesn't use one of the best features of the DA1469x devices: sleep. Thankfully the Kconfig system allows us to enable sleep easily. Simply add these lines:

CONFIG_PM=y

CONFIG_DEBUG_OPTIMIZATIONS=y

CONFIG_PM_DEVICE=y

CONFIG_REGULATOR=y

To the prj.conf file of the example you're building.

Compiling Micropython

Compiling Micropython for any board supported by Zephyr is remarkably easy(Do note windows isn't supported). Just clone the Micropython repo and build the embedded Zephyr project. The suggested place to clone Micropython is in the zephyrproject folder.

git clone -b micropython-demo-2023 https://github.com/dialog-semiconductor/micropython.git

This is the public facing repo which contains board support files that have not been merged into main yet.

With the Micropython repo cloned you are ready to build and flash:

west build -p auto -b da1469x_dk_pro ../micropython/ports/zephyr/

west flash

After flashing the board is reset and micropython is running. The Micropython REPL can be used over the serial port of the devkit.