boards/nucleo_f446re/README.md
For more details visit NUCLEO-F446RE website.
The kernel can be programmed using OpenOCD. cd into boards/nucleo_f446re
directory and run:
$ make flash
(or)
$ make flash-debug
Note: Unlike other Tock platforms, the default kernel image for this board will clear flashed apps when the kernel is loaded. This is to support the non-tockloader based app flash procedure below.
Apps are built out-of-tree. Once an app is built, you can use
arm-none-eabi-objcopy with --update-section to create an ELF image with the
apps included.
$ arm-none-eabi-objcopy \
--set-section-flags .apps=LOAD,ALLOC \
target/thumbv7em-none-eabi/debug/nucleo_f446re.elf \
target/thumbv7em-none-eabi/debug/nucleo_f446re-app.elf
$ arm-none-eabi-objcopy \
--update-section .apps=../../../libtock-c/examples/c_hello/build/cortex-m4/cortex-m4.tbf \
target/thumbv7em-none-eabi/debug/nucleo_f446re-app.elf
For example, you can update Makefile as follows.
APP=../../../libtock-c/examples/c_hello/build/cortex-m4/cortex-m4.tbf
KERNEL=$(TOCK_ROOT_DIRECTORY)/target/$(TARGET)/debug/$(PLATFORM).elf
KERNEL_WITH_APP=$(TOCK_ROOT_DIRECTORY)/target/$(TARGET)/debug/$(PLATFORM)-app.elf
.PHONY: program
program: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/debug/$(PLATFORM).elf
arm-none-eabi-objcopy --set-section-flags .apps=LOAD,ALLOC $(KERNEL) $(KERNEL_WITH_APP)
arm-none-eabi-objcopy --update-section .apps=$(APP) $(KERNEL_WITH_APP)
$(OPENOCD) $(OPENOCD_OPTIONS) -c "init; reset halt; flash write_image erase $(KERNEL_WITH_APP); verify_image $(KERNEL_WITH_APP); reset; shutdown"
After setting APP, KERNEL, KERNEL_WITH_APP, and program target
dependency, you can do
$ make program
to flash the image.
udev ruleYou may want to add a udev rule in /etc/udev/rules.d that allows you to
interact with the board as a user instead of as root. You can install this as
/etc/udev/rules.d/99-stlinkv2-1.rules:
# stm32 nucleo boards, with onboard st/linkv2-1
# ie, STM32F0, STM32F4.
# STM32VL has st/linkv1, which is quite different
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
MODE:="0660", GROUP="dialout", \
SYMLINK+="stlinkv2-1_%n"