Repository: incubator-mynewt-site Updated Branches: refs/heads/master 690d31307 -> 5ec12143e
changed runtimeinc to runtimeco in docs, updated install instructions for linux , blinky for stm32F4-discovery Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/189cb93a Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/189cb93a Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/189cb93a Branch: refs/heads/master Commit: 189cb93a7698627482269b6a721eb357ba745b3b Parents: 690d313 Author: aditihilbert <[email protected]> Authored: Fri May 5 14:24:44 2017 -0700 Committer: aditihilbert <[email protected]> Committed: Fri May 5 14:24:44 2017 -0700 ---------------------------------------------------------------------- docs/os/get_started/native_install_intro.md | 17 ++ docs/os/tutorials/blinky_stm32f4disc.md | 207 +++++++++++++++++++++++ docs/os/tutorials/pics/stm32f4_disc.jpg | Bin 0 -> 40575 bytes 3 files changed, 224 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/189cb93a/docs/os/get_started/native_install_intro.md ---------------------------------------------------------------------- diff --git a/docs/os/get_started/native_install_intro.md b/docs/os/get_started/native_install_intro.md new file mode 100644 index 0000000..2cadfa1 --- /dev/null +++ b/docs/os/get_started/native_install_intro.md @@ -0,0 +1,17 @@ +# Native Installation + +This section shows you how to install tools on Mac OS and Linux platforms to develop, build, run, and debug Mynewt OS applications. You can build Mynewt OS applications to run as a native application on your computer or to run on your target board. These tools include: + +* Newt tool - Tool to create, build, load, and debug a mynewt target. + + * See [Installing the Newt Tool on Mac OS](/newt/install/newt_mac.md) to install on Mac OS. + * See [Installing the Newt Tool on Linux](/newt/install/newt_linux.md) to install on Linux. + + +<br> + +* Native toolchain - Native toolchain to build and run Mynewt OS as a native application on your computer. + (See [Installing Native Toolchain](/os/get_started/native_install.md)). + +* Cross toolchain for ARM - Cross toolchain for ARM to build and run a Mynewt OS application on a target board + (See [Installing Cross Tools for ARMs](/os/get_started/cross_tools.md)). http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/189cb93a/docs/os/tutorials/blinky_stm32f4disc.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/blinky_stm32f4disc.md b/docs/os/tutorials/blinky_stm32f4disc.md new file mode 100644 index 0000000..cf0e74e --- /dev/null +++ b/docs/os/tutorials/blinky_stm32f4disc.md @@ -0,0 +1,207 @@ +## Blinky, your "Hello World!", on STM32F4-Discovery +This tutorial shows you how to create, build, and run the Blinky application on the STM32F4-Discovery board. +<br> + +<br> + +### Prerequisites + +* Meet the prerequisites listed in [Project Blinky](/os/tutorials/blinky.md). +* Have a STM32F4-Discovery board. +* Have a USB type A to Mini-B cable. +* Install a patched version of OpenOCD 0.10.0 described in [Install OpenOCD](os/get_started/cross_tools/). + +### Create a Project +Create a new project if you do not have an existing one. You can skip this step and proceed to [create the targets](#create_targets) if you already have a project created. + +Run the following commands to create a new project: + +```no-highlight + $ mkdir ~/dev + $ cd ~/dev + $ newt new myproj + Downloading project skeleton from apache/incubator-mynewt-blinky... + Installing skeleton in myproj... + Project myproj successfully created. + $ cd myproj + $ newt install + apache-mynewt-core + $ +``` + +<br> + +### <a name="create_targets"></a>Create the Targets + +Create two targets for the STM32F4-Discovery board - one for the bootloader and one for the Blinky application. + +Run the following `newt target` commands, from your project directory, to create a bootloader target. We name the target `stm32f4disc_boot`: + +```no-highlight +$ newt target create stm32f4disc_boot +$ newt target set stm32f4disc_boot app=@apache-mynewt-core/apps/boot +$ newt target set stm32f4disc_boot bsp=@apache-mynewt-core/hw/bsp/stm32f4discovery +$ newt target set stm32f4disc_boot build_profile=optimized +``` + +<br> +Run the following `newt target` commands to create a target for the Blinky application. We name the target `stm32f4disc_blinky`: + +```no-highlight +$ newt target create stm32f4disc_blinky +$ newt target set stm32f4disc_blinky app=apps/blinky +$ newt target set stm32f4disc_blinky bsp=@apache-mynewt-core/hw/bsp/stm32f4discovery +$ newt target set stm32f4disc_blinky build_profile=debug +``` +<br> +You can run the `newt target show` command to verify the target settings: + +```no-highlight +$ newt target show +targets/my_blinky_sim + app=apps/blinky + bsp=@apache-mynewt-core/hw/bsp/native + build_profile=debug +targets/stm32f4disc_blinky + app=apps/blinky + bsp=@apache-mynewt-core/hw/bsp/stm32f4discovery + build_profile=debug +targets/stm32f4disc_boot + app=@apache-mynewt-core/apps/boot + bsp=@apache-mynewt-core/hw/bsp/stm32f4discovery + build_profile=optimized +``` +<br> + +### Build the Target Executables + +Run the `newt build stm32f4disc_boot` command to build the bootloader: + +```no-highlight +$ newt build stm32f4disc_boot +Building target targets/stm32f4disc_boot +Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/image_ec256.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/bootutil_misc.c +Compiling repos/apache-mynewt-core/apps/boot/src/boot.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/image_rsa.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/image_validate.c +Compiling repos/apache-mynewt-core/boot/bootutil/src/loader.c + ... + +Archiving sys_flash_map.a +Archiving sys_mfg.a +Archiving sys_sysinit.a +Archiving util_mem.a +Linking ~/dev/myproj/bin/targets/stm32f4disc_boot/app/apps/boot/boot.elf +Target successfully built: targets/stm32f4disc_boot +``` + +<br> +Run the `newt build stm32f4disc_blinky` command to build the Blinky application: + +```no-highlight +$newt build stm32f4disc_blinky +Building target targets/stm32f4disc_blinky +Compiling apps/blinky/src/main.c +Compiling repos/apache-mynewt-core/hw/bsp/stm32f4discovery/src/sbrk.c +Compiling repos/apache-mynewt-core/hw/bsp/stm32f4discovery/src/system_stm32f4xx.c +Compiling repos/apache-mynewt-core/hw/bsp/stm32f4discovery/src/hal_bsp.c +Assembling repos/apache-mynewt-core/hw/bsp/stm32f4discovery/src/arch/cortex_m4/startup_STM32F40x.s +Compiling repos/apache-mynewt-core/hw/cmsis-core/src/cmsis_nvic.c +Compiling repos/apache-mynewt-core/hw/drivers/uart/src/uart.c +Compiling repos/apache-mynewt-core/hw/drivers/uart/uart_hal/src/uart_hal.c +Compiling repos/apache-mynewt-core/hw/hal/src/hal_common.c +Compiling repos/apache-mynewt-core/hw/hal/src/hal_flash.c + + ... + +Archiving sys_sysinit.a +Archiving util_mem.a +Linking ~/dev/myproj/bin/targets/stm32f4disc_blinky/app/apps/blinky/blinky.elf +Target successfully built: targets/stm32f4disc_blinky +``` + + +<br> + +### Sign and Create the Blinky Application Image + +Run the `newt create-image stm32f4disc_blinky 1.0.0` command to create and sign the application image. You may assign an arbitrary version (e.g. 1.0.0) to the image. + +```no-highlight +$newt create-image stm32f4disc_blinky 1.0.0 +App image succesfully generated: ~/dev/myproj/bin/targets/stm32f4disc_blinky/app/apps/blinky/blinky.img +``` + +<br> + +### Connect to the Board + +Connect a USB type A to Mini-B cable from your computer to the port the board indicated on the diagram: + +<br> +<br> + + +<br> + +You should see the small PWR red LED light up. + +### Load the Bootloader and the Blinky Application Image + +Run the `newt load stm32f4disc_boot` command to load the bootloader onto the board: + +```no-highlight +$newt load stm32f4disc_boot +Loading bootloader +``` +<br> +Run the `newt load stm32f4disc_blinky` command to load the Blinky application image onto the board. +```no-highlight +$newt load stm32f4disc_blinky +Loading app image into slot 1 +``` + +You should see the small green LD4 LED on the board blink! + +Note: If the LED does not blink, try resetting your board. + +<br> + +**Note:** If you want to erase the flash and load the image again, start a debug session, and enter `mon stm32f2x mass_erase 0` at the gdb prompt: +```no-highlight +$newt debug stm32f4disc_blinky +[~/dev/myproj/repos/apache-mynewt-core/hw/bsp/stm32f4discovery/stm32f4discovery_debug.sh ~/dev/myproj/repos/apache-mynewt-core/hw/bsp/stm32f4discovery ~/dev/myproj/bin/targets/stm32f4disc_blinky/app/apps/blinky/blinky] +Open On-Chip Debugger 0.10.0 +Licensed under GNU GPL v2 +For bug reports, read + http://openocd.org/doc/doxygen/bugs.html +Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD +adapter speed: 2000 kHz +adapter_nsrst_delay: 100 +none separate +Info : Unable to match requested speed 2000 kHz, using 1800 kHz +Info : Unable to match requested speed 2000 kHz, using 1800 kHz +Info : clock speed 1800 kHz +Info : STLINK v2 JTAG v25 API v2 SWIM v14 VID 0x0483 PID 0x374B +Info : using stlink api v2 +Info : Target voltage: 2.881129 +Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints +target halted due to debug-request, current mode: Thread + + ... + +Reading symbols from ~/dev/myproj/bin/targets/stm32f4disc_blinky/app/apps/blinky/blinky.elf...done. +target halted due to debug-request, current mode: Thread +xPSR: 0x41000000 pc: 0x08021e90 psp: 0x20002290 +Info : accepting 'gdb' connection on tcp/3333 +Info : device id = 0x10076413 +Info : flash size = 1024kbytes +0x08021e90 in __WFI () at repos/apache-mynewt-core/hw/cmsis-core/src/ext/core_cmInstr.h:342 +342 __ASM volatile ("wfi"); +(gdb) mon stm32f2x mass_erase 0 +stm32x mass erase complete +stm32x mass erase complete +(gdb) +``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/189cb93a/docs/os/tutorials/pics/stm32f4_disc.jpg ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/pics/stm32f4_disc.jpg b/docs/os/tutorials/pics/stm32f4_disc.jpg new file mode 100755 index 0000000..cbed05f Binary files /dev/null and b/docs/os/tutorials/pics/stm32f4_disc.jpg differ
