66 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2024-05-08 10:50:50 +02:00
![](./docs/IMG_2915.jpg)
2020-10-18 22:02:17 +02:00
## Build environment
On Ubuntu/Debian install
* ``gcc-arm-none-eabi``
* ``openocd``
Alternatively use a prepared Docker image
2020-10-21 01:00:26 +02:00
docker run -it --rm -u ${UID} -v ${PWD}:/mnt wollud1969/build-env-arm-none-eabi:1.1.0 bash
2020-10-18 22:02:17 +02:00
2020-10-21 01:00:26 +02:00
Start the container from the project root. Or use the script ``startBuildEnv.sh`` from the tools directory.
2020-10-18 22:02:17 +02:00
Get the STM32CubeMX tool from the ST homepage. You may use this [link](https://www.st.com/en/development-tools/stm32cubemx.html).
## Preparing generated code to include user code
After code generation in CubeMX the ``Makefile`` and the file ``main.c`` in ``Core/Src`` needs
to be edited to include user code. From the ``cube`` directory in the project root run:
../tools/insertMyCode.sh
User code has to life in ``User/Src`` and ``User/Inc``. All ``*.c`` file from ``User/Src`` will be
attached to the ``C_SOURCES`` variable in the ``Makefile``.
## Building
From the ``cube`` directory in the project root simply run
make
## Uploading to the target
Start ``openocd`` from the project root using the existing configuration file (for derived projects
adjust the configuration concerning the use MCU)
openocd -f openocd.cfg
Connect to the started ``openocd`` server using
nc localhost 4444
To upload a built binary enter
reset init
reset halt
2020-10-24 19:43:22 +02:00
flash write_image erase /home/wn/Workspaces/$PROJECT/cube/build/cube.elf
2020-10-18 22:02:17 +02:00
reset run
2020-10-24 19:43:22 +02:00
Make sure to use the absolute path. Alternatively, use the script ``upload.sh`` from the tools directory.
2020-10-18 22:02:17 +02:00