Giter VIP home page Giter VIP logo

stm32-ecu's Introduction

Download the stm32-ecu project

  • cd ~/
  • git clone [email protected]:eshjordan/stm32-ecu.git
  • cd stm32-ecu
  • git submodule update --init --recursive

Setup and flash the STM32 Starter Pack

Reference: https://wiki.st.com/stm32mpu/wiki/STM32MP15_Discovery_kits_-_Starter_Package

Create an account at https://www.st.com and log in. The site can be very difficult to use, it will often refuse to log you in, or you can be logged in in one tab, but not in another. Try a different browser, clearing cache, restarting, etc. if it does this.

Download STM32CubeProgrammer

Unzip

  • cd ~/Downloads
  • unzip en.stm32cubeprg-lin_v2-10-0_v2.10.0.zip -d STM32CubeProgrammer

Execute the Linux installer, which guides you through the installation process

  • cd ./STM32CubeProgrammer
  • ./SetupSTM32CubeProgrammer-2.9.0.linux

Leave the default path:

  • /home/${USER}/STMicroelectronics/STM32Cube/STM32CubeProgrammer

Add to PATH:

  • echo "export PATH=/home/${USER}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin:${PATH}" >> ~/.bashrc
  • source ~/.bashrc

Install drivers to connect to the board via USB

  • sudo apt update && sudo apt install -y libusb-1.0-0
  • cd ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Drivers/rules
  • sudo cp . /etc/udev/rules.d/

Setup STM32MP15 Ecosystem structure

  • mkdir -p ~/STM32MP15-Ecosystem-v3.1.0
  • cd ~/STM32MP15-Ecosystem-v3.1.0
  • mkdir -p Starter-Package Developer-Package Distribution-Package

Download Starter Pack image and flash to the board:

The trusted boot chain is the default solution delivered by STMicroelectronics. Thus, the steps below use the image for the trusted boot chain

ENSURE YOU CONNECT THE OTG USB-C TO EITHER USB-C OR USB-3 ON THE HOST PC!! FLASHING WILL FAIL WITHOUT THIS!! Let's flash the downloaded image on the microSD card:

  • Set both boot switches (1) to the off position

  • Connect the USB Type-Cā„¢ (OTG) port (2) to the host PC that contains the downloaded image

  • Insert the delivered microSD card into the dedicated slot (3)

  • Connect the delivered power supply to the USB Type-Cā„¢ port (4)

  • Press the reset button (5) to reset the board

  • cd ~/STM32MP15-Ecosystem-v3.1.0/Starter-Package/stm32mp1-openstlinux-5.10-dunfell-mp1-21-11-17/images/stm32mp1

  • STM32_Programmer_CLI -l usb

  • Read the output of the last command, and replace port=<USB_NUM> in the following command with the correct port. E.g, USB1:

    • STM32_Programmer_CLI -c port=usb1 -w flashlayout_st-image-weston/extensible/FlashLayout_sdcard_stm32mp157d-dk1-extensible.tsv
  • Flashing may take some time, ~5+ min

  • Check it flashed correctly, look for Flashing service completed successfully in the output

  • Disconnect the power from the board

  • Set both boot switches to the on position

  • Connect the power to the board

  • Wait a few minutes, the kernel is resizing all of the filesystems

  • In the meantime:

  • Download minicom (or another serial terminal program)

  • sudo apt update && sudo apt install -y minicom

  • Connect the ST-LINK/V2-1 USB micro-B port to the host PC

Attach a terminal to the board. One of the following commands should work:

  • minicom -D /dev/ttyACM0

  • minicom -D /dev/ttyS0

  • When the connection is open, hit the reset button on the board, you should see the boot log from the device

  • If the log mentions resizing the filesystem, wait for the terminal to be ready, might take up to 5 mins

  • Look for root@stm32mp1:~# to know it's finished

  • To exit minicom, press CTRL-A, then X, then press enter

If you want to connect over ethernet in future, use this serial connection to get the device IP address

  • Open a serial connection
  • Connect the board to ethernet
  • Press the reset button on the board
  • Wait for the terminal to become available
  • Run ifconfig to grab the IP address
  • You can close the serial connection and SSH in like usual. Probably a good idea to set a static IP address for it
  • E.g. ssh [email protected]

The script provided to flash firmware onto the board requires rsync to be installed on both the host and target.

  • Connect the board to ethernet
  • Press the reset button on the board
  • Connect via ssh or serial connection
  • apt-get update
  • apt-get install rsync
  • Now you can run the script to transfer kernel modules, applications, etc.

Setup and flash the STM32 Developer Pack

Setup the Developer Pack SDK

Ensure the Starter Pack is flashed to the board first

Setup an alias get_stm to source the cross-compilation environment:

  • echo "alias get_stm=\"unset LD_LIBRARY_PATH; source ~/STM32MP15-Ecosystem-v3.1.0/Developer-Package/SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi\"" >> ~/.bashrc

  • source ~/.bashrc

  • get_stm

  • Running echo $ARCH should return arm

  • Running echo $CROSS_COMPILE should return arm-ostl-linux-gnueabi-

  • Running $CC --version should return arm-ostl-linux-gnueabi-gcc (GCC) 9.3.0

  • Running echo $OECORE_SDK_VERSION should return 3.1.11-openstlinux-5.10-dunfell-mp1-21-11-17

Setup the Linux kernel

Ensure you downloaded the STM32MP1 OpenSTLinux Developer Package (Source) from https://www.st.com earlier

Setup the U-Boot

Setup the TF-A

Setup the OP-TEE

Setup debug symbols

Installing STM32CubeIDE

  • Ensure you are already logged into https://st.com

  • Download the STM32CubeIDE from:

  • https://www.st.com/en/development-tools/stm32cubeide.html

  • unzip ~/Downloads/en.st-stm32cubeide_1.9.0_12015_20220302_0855_amd64.deb_bundle.sh_v1.9.0.zip -d ~/Downloads/

  • chmod +x ~/Downloads/st-stm32cubeide_1.9.0_12015_20220302_0855_amd64.deb_bundle.sh

  • sudo ~/Downloads/st-stm32cubeide_1.9.0_12015_20220302_0855_amd64.deb_bundle.sh

Installing STM32Cube MPU Package

Setting up the project

Start STM32CubeIDE for the first time

  • Leave the default workspace directory:
  • ${HOME}/STM32CubeIDE/workspace_1.9.0
  • Import the stm32-ecu project and relevant sub-projects
  • sudo apt update && sudo apt install -y bear

ESP32

Install the ESP-IDF extension: Id: espressif.esp-idf-extension VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=espressif.esp-idf-extension

echo "alias get_idf='. $HOME/esp/esp-idf/export.sh'" >> ~/.bashrc

sudo cp ${HOME}/.espressif/tools/openocd-esp32/v0.11.0-esp32-20211220/openocd-esp32/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d

Resources

stm32-ecu's People

Contributors

eshjordan avatar

Watchers

Lucas Candido avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.