Repository: incubator-mynewt-site Updated Branches: refs/heads/develop d7a35b7b2 -> 37183d948
Added Blinky stm32F4-discovery tutorial and changed runtimeinc to runtimeco in docs 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/f0aeb7ea Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/f0aeb7ea Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/f0aeb7ea Branch: refs/heads/develop Commit: f0aeb7ea0cc0ddc82102f906704a525d1c4dd62f Parents: d7a35b7 Author: cwanda <[email protected]> Authored: Wed Apr 26 16:53:00 2017 -0700 Committer: cwanda <[email protected]> Committed: Wed Apr 26 16:53:00 2017 -0700 ---------------------------------------------------------------------- docs/os/modules/drivers/driver.md | 2 +- docs/os/tutorials/STM32F303.md | 6 +- docs/os/tutorials/arduino_zero.md | 2 +- docs/os/tutorials/blinky.md | 1 + docs/os/tutorials/blinky_stm32f4disc.md | 207 +++++++++++++++++++++++++++ docs/os/tutorials/nrf52_adc.md | 2 +- docs/os/tutorials/pics/stm32f4_disc.jpg | Bin 0 -> 40575 bytes docs/os/tutorials/repo/add_repos.md | 2 +- docs/os/tutorials/wi-fi_on_arduino.md | 2 +- mkdocs.yml | 1 + 10 files changed, 217 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/docs/os/modules/drivers/driver.md ---------------------------------------------------------------------- diff --git a/docs/os/modules/drivers/driver.md b/docs/os/modules/drivers/driver.md index d090809..1c2d44b 100644 --- a/docs/os/modules/drivers/driver.md +++ b/docs/os/modules/drivers/driver.md @@ -28,7 +28,7 @@ Device drivers in the Mynewt context includes libraries that interface with devi * Device drivers should have a consistent structure and unified interface whenever possible. For example, we have a top-level package, âadcâ, which contains the interface for all ADC drivers, and then we have the individual implementation of the driver itself. The following source files point to this: * high-level ADC API: `hw/drivers/adc/include/adc/adc.h` - * implementation of ADC for STM32F4: `hw/drivers/adc/adc_stm32f4/src/adc_stm32f4.c` (As of the 1.0.0-beta release, ADC for nRF51 and nRF52 are available at an external [repo](https://github.com/runtimeinc/mynewt_nordic/tree/master/hw/drivers/adc). They are expected to be pulled into the core repo on Apache Mynewt after the license terms are clarified.). The only exported call in this example is `int stm32f4_adc_dev_init(struct os_dev *, void *)` which is passed as a function pointer to `os_dev_create()` in `hal_bsp.c`, when the adc device is created. + * implementation of ADC for STM32F4: `hw/drivers/adc/adc_stm32f4/src/adc_stm32f4.c` (As of the 1.0.0-beta release, ADC for nRF51 and nRF52 are available at an external [repo](https://github.com/runtimeco/mynewt_nordic/tree/master/hw/drivers/adc). They are expected to be pulled into the core repo on Apache Mynewt after the license terms are clarified.). The only exported call in this example is `int stm32f4_adc_dev_init(struct os_dev *, void *)` which is passed as a function pointer to `os_dev_create()` in `hal_bsp.c`, when the adc device is created. * Device drivers should be easy to use. In Mynewt, creating a device initializes it as well, making it readily available for the user to open, use (e.g. read, configure etc.) and close. Creating a device is simple using `os_dev_create(struct os_dev *dev, char *name, uint8_t stage, uint8_t priority, os_dev_init_func_t od_init, void *arg)`. The `od_init` function is defined within the appropriate driver directory e.g. `stm32f4_adc_dev_init` in `hw/drivers/adc/adc_stm32f4/src/adc_stm32f4.c` for the ADC device initialization function. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/docs/os/tutorials/STM32F303.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/STM32F303.md b/docs/os/tutorials/STM32F303.md index 7d9fd91..bb5e0e8 100644 --- a/docs/os/tutorials/STM32F303.md +++ b/docs/os/tutorials/STM32F303.md @@ -63,14 +63,14 @@ Edit the file `project.yml` with your favorite editor and add the following repository details in the file (after the core repository). This gives newt the information to contact the repository and extract its contents. In this case, the repository is on github in -the `runtimeinc` collection. Its name is `mynewt-stm32f3` and we will accept -any version up to the latest. You can look at the contents [here](https://github.com/runtimeinc/mynewt_stm32f3). +the `runtimeco` collection. Its name is `mynewt-stm32f3` and we will accept +any version up to the latest. You can look at the contents [here](https://github.com/runtimeco/mynewt_stm32f3). ``` repository.mynewt_stm32f3: type: github vers: 0-latest - user: runtimeinc + user: runtimeco repo: mynewt_stm32f3 ``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/docs/os/tutorials/arduino_zero.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/arduino_zero.md b/docs/os/tutorials/arduino_zero.md index 68499b3..d019cb2 100644 --- a/docs/os/tutorials/arduino_zero.md +++ b/docs/os/tutorials/arduino_zero.md @@ -67,7 +67,7 @@ repository.apache-mynewt-core: repository.mynewt_arduino_zero: type: github vers: 1-latest - user: runtimeinc + user: runtimeco repo: mynewt_arduino_zero $ ``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/docs/os/tutorials/blinky.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/blinky.md b/docs/os/tutorials/blinky.md index 04efdc3..e00fe53 100644 --- a/docs/os/tutorials/blinky.md +++ b/docs/os/tutorials/blinky.md @@ -13,6 +13,7 @@ Tutorials are available for the following boards: * [Blinky on an Olimex](/os/tutorials/olimex.md) * [Blinky on a nRF52](/os/tutorials/nRF52.md) * [Blinky on a RedBear Nano 2](/os/tutorials/rbnano2.md) +* [Blinky on a STM32F4-Discovery](/os/tutorials/blinky_stm32f4disc.md) We also have a tutorial that shows you how to add [Console and Shell to the Blinky Application](/os/tutorials/blinky_console.md). <br> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/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/f0aeb7ea/docs/os/tutorials/nrf52_adc.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/nrf52_adc.md b/docs/os/tutorials/nrf52_adc.md index 3fe1fa5..a27a433 100644 --- a/docs/os/tutorials/nrf52_adc.md +++ b/docs/os/tutorials/nrf52_adc.md @@ -71,7 +71,7 @@ repository.apache-mynewt-core: repository.mynewt_nordic: type: github vers: 1-latest - user: runtimeinc + user: runtimeco repo: mynewt_nordic ``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/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 http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/docs/os/tutorials/repo/add_repos.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/repo/add_repos.md b/docs/os/tutorials/repo/add_repos.md index 370c0d3..baf4f50 100644 --- a/docs/os/tutorials/repo/add_repos.md +++ b/docs/os/tutorials/repo/add_repos.md @@ -145,7 +145,7 @@ repository.apache-Mynewt-core: repository.Mynewt_arduino_zero: type: github vers: 1-latest - user: runtimeinc + user: runtimeco repo: Mynewt_arduino_zero ``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/docs/os/tutorials/wi-fi_on_arduino.md ---------------------------------------------------------------------- diff --git a/docs/os/tutorials/wi-fi_on_arduino.md b/docs/os/tutorials/wi-fi_on_arduino.md index 132968e..4a49291 100644 --- a/docs/os/tutorials/wi-fi_on_arduino.md +++ b/docs/os/tutorials/wi-fi_on_arduino.md @@ -85,7 +85,7 @@ repository.apache-mynewt-core: repository.mynewt_arduino_zero: type: github vers: 1-latest - user: runtimeinc + user: runtimeco repo: mynewt_arduino_zero $ ``` http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/f0aeb7ea/mkdocs.yml ---------------------------------------------------------------------- diff --git a/mkdocs.yml b/mkdocs.yml index 8d51e74..62624f7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -35,6 +35,7 @@ pages: - 'Blinky on Olimex': 'os/tutorials/olimex.md' - 'Blinky on nRF52': 'os/tutorials/nRF52.md' - 'Blinky on RedBear Nano 2': 'os/tutorials/rbnano2.md' + - 'Blinky on STM32F4-Discovery': 'os/tutorials/blinky_stm32f4disc.md' - 'Add Console and Shell to Blinky': 'os/tutorials/blinky_console.md' - 'Work with repositories': - toc: 'os/tutorials/repo/add_repos.md'
