Download a generic firmware skeleton (“bootstrap image”) that applies to any hardware and then throw in additional applicable pkgs to generate a build for a specific board, namely the STM32F303VC MCU from STMicroelectronics.
[user:~/dev]$ newt app create test_project Downloading app skeleton from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-tadpole.git... ok! app test_project successfully created in ~/dev/go/test_project [user:~/dev]$ cd test_project/ [user:~/dev/test_project]$ ls README.md compiler hw libs app.yml
pkg-list.yml) will be used to check dependencies during the pkg install to ensure completeness. It serves as a reference for all the pkgs in the pkg-list that one can choose from and install.[user:~/dev/test_project]$ newt app add-pkg-list larva https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git Downloading pkg-list.yml from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git/master... ok! Verifying pkg-list.yml format... ok! pkg-list larva successfully installed to app.
[user:~/dev/test_project]$ newt pkg install project/blinky Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/master... ok! Installing project/blinky Installing libs/console/full Installing libs/shell Installation was a success! [user:~/dev/test_project]$ newt pkg install hw/bsp/stm32f3discovery Downloading larva from https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/master... ok! Installing hw/bsp/stm32f3discovery Installing hw/mcu/stm/stm32f3xx Installing libs/cmsis-core Installing compiler/arm-none-eabi-m4 Installation was a success!
[user:~/dev/test_project]$ newt target create blink_f3disc Creating target blink_f3disc Target blink_f3disc successfully created! [user:~/dev/test_project]$ newt target set blink_f3disc project=blinky Target blink_f3disc successfully set project to blinky [user:~/dev/test_project]$ newt target set blink_f3disc bsp=hw/bsp/stm32f3discovery Target blink_f3disc successfully set bsp to hw/bsp/stm32f3discovery [user:~/dev/test_project]$ newt target set blink_f3disc compiler_def=debug Target blink_f3disc successfully set compiler_def to debug [user:~/dev/test_project]$ newt target set blink_f3disc compiler=arm-none-eabi-m4 Target blink_f3disc successfully set compiler to arm-none-eabi-m4 [user:~/dev/test_project]$ newt target set blink_f3disc arch=cortex_m4 Target blink_f3disc successfully set arch to cortex_m4 [user:~/dev/test_project]$ newt target create boot_f3disc Creating target boot_f3disc Target boot_f3disc successfully created! [user:~/dev/test_project]$ newt target set boot_f3disc project=boot Target blink_f3disc successfully set project to blinky [user:~/dev/test_project]$ newt target set boot_f3disc bsp=hw/bsp/stm32f3discovery Target boot_f3disc successfully set bsp to hw/bsp/stm32f3discovery [user:~/dev/test_project]$ newt target set boot_f3disc compiler_def=optimized Target boot_f3disc successfully set compiler_def to debug [user:~/dev/test_project]$ newt target set boot_f3disc compiler=arm-none-eabi-m4 Target boot_f3disc successfully set compiler to arm-none-eabi-m4 [user:~/dev/test_project]$ newt target set boot_f3disc arch=cortex_m4 Target boot_f3disc successfully set arch to cortex_m4 [user:~/dev/test_project]$ newt target show blink_f3disc blink_f3disc arch=cortex_m4 bsp=hw/bsp/stm32f3discovery compiler=arm-none-eabi-m4 compiler_def=debug name=blink_f3disc project=blinky [user:~/dev/test_project]$ newt target show boot_f3disc boot_f3disc arch=cortex_m4 bsp=hw/bsp/stm32f3discovery compiler=arm-none-eabi-m4 compiler_def=debug name=blink_f3disc project=boot
[user:~/dev/test_project]$ cat project/blinky/pkg.yml # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # pkg.name: project/blinky pkg.vers: 0.8.0 pkg.description: Basic example application which blinks an LED. pkg.author: Marko Kiiskila <marko@runtime.io> pkg.homepage: http://mynewt.apache.org/os/get_acclimated/project2/ pkg.repository: https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva pkg.keywords: pkg.deps: - libs/console/full - libs/newtmgr - libs/os - libs/shell - sys/config - sys/log - sys/stats - libs/baselibc
Next, you get to build the targets and generate an executable that can then be uploaded to the board. The STM32F3DISCOVERY board includes an ST-LINK/V2 embedded debug tool interface that will be used to program/debug the board. To program the MCU on the board, simply plug in the two jumpers on CN4, as shown in the picture in red. If you want to learn more about the board you will find the User Manual at http://www.st.com/st-web-ui/static/active/jp/resource/technical/document/user_manual/DM00063382.pdf
[user:~/dev/test_project]$ newt target build boot_f3disc Building target boot_f3 (project = boot) Compiling asprintf.c Compiling atoi.c ... ... Assembling startup_stm32f303xc.s Archiving libstm32f3discovery.a Compiling boot.c Building project boot Linking boot.elf Successfully run! [user:~/dev/test_project]$ newt target build blink_f3disc Building target blink_f3disc (project = blinky) Compiling asprintf.c Compiling atoi.c ... ... Assembling startup_stm32f303xc.s Archiving libstm32f3discovery.a Compiling main.c Building project blinky Linking blinky.elf Successfully run! [user:~/dev/test_project]$ newt target build boot_f3disc Building target boot_f3disc (project = boot) Building project boot Successfully run! [user:~/dev/test_project]$ newt target create-image blink_f3disc 0.0.1 Building target blink_f3disc (project = blinky) Building project blinky
[user:~/dev/test_project]$ newt target download boot_f3disc Downloading with /Users/user/dev/test_project/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh [user:~/dev/test_project]$ newt target download blink_f3disc Downloading with /Users/user/dev/test_project/hw/bsp/stm32f3discovery/stm32f3discovery_download.sh