diff --git a/documentation/source/quick-start/avenger-96-board.rst b/documentation/source/quick-start/avenger-96-board.rst index 2ebbe5b70083bdffa82e689eddb48823d72d7b8d..657a093e96ee668067d71cddb0eb157d10f3c5c5 100644 --- a/documentation/source/quick-start/avenger-96-board.rst +++ b/documentation/source/quick-start/avenger-96-board.rst @@ -76,3 +76,86 @@ Additional information +-------------+--------------------------------------------+ For more details on Avenger 96 board, refer https://www.96boards.org/product/avenger96/. + +Bulding Zephyr onto Avenger96 board +************************************* + +Creating uSD card image for the Avenger96 board +=============================================== + +Steps for building a BSP for ST's development boards is referred here: `<https://wiki.st.com/stm32mpu/index.php/STM32MP1_Distribution_Package>`_. + +Building the BSP for the Avenger96 follows the scheme of the above build process but starts with a different 'repo' manifest file: + +.. code-block:: console + + - Create the build directory following ST's recommendations at https://wiki.st.com/stm32mpu/wiki/Example_of_directory_structure_for_Packages + + - Enter the working directory and execute the following commands + + $ repo init -u https://github.com/dh-electronics/manifest-av96 -b dunfell + + $ repo sync + + $ source layers/meta-arrow/scripts/init-build-env.sh + + $ bitbake av96-weston + +The last command will build the BSP. The full build will take about 1-2 hours dpending on machine and internet speed and will require around 25GB disk space. + + +Flashing an Application to Avenger96 board +****************************************** +When the build completes it puts all the required files into the'deploy' folder. Execute the following commands: + +.. code-block:: console + + $ cd tmp-glibc/deploy/images/stm32mp1-av96/ + + $ ./scripts/create_sdcard_from_flashlayout.sh flashlayout_av96-weston/trusted/ + FlashLayout_sdcard_stm32mp157a-av96-trusted.tsv + +The last command creates FlashLayout_sdcard_stm32mp157a-av96-trusted.raw. +We can write it to a uSD card with: + +.. code-block:: console + + $ sudo dd if=FlashLayout_sdcard_stm32mp157a-av96-trusted.raw bs=1M of=/dev/sdX && sync where /dev/sdX is the block device of the inserted uSD card. + +Once you have built your own AV96 Yocto image, your build provides all the files you need to use the Cube Programmer. + +Debugging +********* +You can debug an application using OpenOCD and GDB. The Solution proposed below is based on the Linux STM32MP1 SDK OpenOCD and is available only for a Linux environment. The firmware must first be loaded by the Cortex®-A7. Developer then attaches the debugger to the running Zephyr using OpenOCD. + +Prerequisite +============ +Install `stm32mp1 developer package <https://wiki.st.com/stm32mpu/index.php/STM32MP1_Developer_Package#Installing_the_SDK>`_. + +1. Start OpenOCD in a dedicated terminal: + +* Start up the sdk environment: + +.. code-block:: console + + Source <SDK installation directory>/environment-setup-cortexa7hf-neon-vfpv4-openstlinux_weston-linux-gnueabi + +* Start OpenOCD: + +.. code-block:: console + + ${OECORE_NATIVE_SYSROOT}/usr/bin/openocd -s ${OECORE_NATIVE_SYSROOT}/usr/share/openocd/scripts -f board/ stm32mp15x_ev1_jlink_jtag.cfg + +2. Run gdb in Zephyr environment: + +.. code-block:: console + + # On Linux + cd $ZEPHYR_BASE/samples/hello_world + mkdir -p build && cd build + + # Use cmake to configure a Ninja-based build syste + cmake -GNinja -DBOARD=96b_avenger96 .. + + # Now run ninja on the generated build system: + ninja debug