Repository: incubator-mynewt-site Updated Branches: refs/heads/asf-site 2393faf30 -> 477d85dcd
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/477d85dc/os/tutorials/olimex/index.html ---------------------------------------------------------------------- diff --git a/os/tutorials/olimex/index.html b/os/tutorials/olimex/index.html index 5df2b89..1a5266b 100644 --- a/os/tutorials/olimex/index.html +++ b/os/tutorials/olimex/index.html @@ -454,12 +454,18 @@ <h2 id="blinky-your-hello-world">Blinky, Your Hello World!<a class="headerlink" href="#blinky-your-hello-world" title="Permanent link">¶</a></h2> <h3 id="objective">Objective<a class="headerlink" href="#objective" title="Permanent link">¶</a></h3> -<p>Learn how to use packages from a default application repository of Mynewt to build your first <em>Hello World</em> application (Blinky) on a target board. Once built using <em>newt</em> tool, this application will blink the LED lights on the target board. Fun stuff!</p> -<p>This tutorial will guide to achieve the following, assuming you have already set up the environment on your computer to use Mynewt OS and newt tool:</p> -<p>Download packages and use tools to create a runtime image for a board to make its LED blink. You have two choices here: - * <a href="#use-sram-to-make-led-blink">Download an image to SRAM</a>, or - * <a href="#use-flash-to-make-led-blink">Download it to flash</a>.</p> +<p>Learn how to use packages from a default application repository of Mynewt to build your first <em>Hello World</em> application (Blinky) on a target board. Once built using the <em>newt</em> tool, this application will blink the LED lights on the target board. Fun stuff!</p> +<p>This tutorial will guide you to achieve the following, assuming you have already set up the environment on your computer to use Mynewt OS and newt tool:</p> +<ul> +<li>Download packages and use tools to create a runtime image for a board to make its LED blink. You have two choices here:<ul> +<li><a href="#use-sram-to-make-led-blink">Download an image to SRAM</a>, or </li> +<li><a href="#use-flash-to-make-led-blink">Download it to flash</a>.</li> +</ul> +</li> +</ul> +<p><br></p> <p><strong> Time Requirement</strong>: Allow yourself a couple of hours for this project if you are relatively new to embedded systems and playing with development boards. Those jumpers can be pesky!</p> +<p><br></p> <h3 id="what-you-need">What you need<a class="headerlink" href="#what-you-need" title="Permanent link">¶</a></h3> <ol> <li>STM32-E407 development board from Olimex. You can order it from <a href="http://www.mouser.com/ProductDetail/Olimex-Ltd/STM32-E407/?qs=UN6GZl1KCcit6Ye0xmPO4A%3D%3D">http://www.mouser.com</a>, <a href="http://www.digikey.com/product-detail/en/STM32-E407/1188-1093-ND/3726951">http://www.digikey.com</a>, and other places.</li> @@ -467,105 +473,92 @@ <li>USB A-B type cable to connect the debugger to your personal computer</li> <li>Personal Computer with Mac OS (Mac: OS X Yosemite Version 10.10.5) or Linux box (Ubuntu 14.10: Utopic Unicorn)</li> <li>An account on Github repository and <em>git</em> installed on your computer.</li> -<li>It assumed you already installed native tools described <a href="../../get_started/native_tools/">here</a></li> +<li>It is assumed you have already installed newt tool. </li> +<li>It is assumed you already installed native tools as described <a href="../../get_started/native_tools/">here</a></li> </ol> -<p>Also, we assume that you're familiar with UNIX shells.</p> -<p>Let's gets started!</p> +<p>Also, we assume that you're familiar with UNIX shells. Let's gets started!</p> +<p><br></p> <h3 id="use-sram-to-make-led-blink">Use SRAM to make LED blink<a class="headerlink" href="#use-sram-to-make-led-blink" title="Permanent link">¶</a></h3> <p>If you wish to build the image to run from the onboard SRAM on Olimex board, follow the steps below:</p> -<h4 id="preparing-the-software">Preparing the Software<a class="headerlink" href="#preparing-the-software" title="Permanent link">¶</a></h4> +<p><br></p> +<h4 id="prepare-the-software">Prepare the Software<a class="headerlink" href="#prepare-the-software" title="Permanent link">¶</a></h4> <ul> -<li> -<p>Make sure the PATH environment variable includes the $HOME/dev/go/bin directory. </p> -</li> -<li> -<p>If you have cloned the larva repository for the simulator test in the previous section, you can skip this step. Otherwise, you have to create a repository for the project. Go to ~/dev and clone the larva repository from the apache git repository into a local directory named <code>larva</code>.</p> -</li> +<li>Make sure the PATH environment variable includes the $HOME/dev/go/bin directory. </li> </ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev - $ git clone https://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva.git larva - $ ls - - go larva - $ ls larva - DISCLAIMER NOTICE app.yml compiler hw net project sys - LICENSE README.md autotargets fs libs pkg-list.yml scripts +<p><br></p> +<h4 id="create-a-project">Create a project.<a class="headerlink" href="#create-a-project" title="Permanent link">¶</a></h4> +<p>Create a new project to hold your work. For a deeper understanding, you can read about project creation in +<a href="../../get_started/project_create/">Get Started -- Creating Your First Project</a> +or just follow the commands below.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ mkdir ~/dev + $ cd ~/dev + $ newt new myproj + Downloading project skeleton from apache/incubator-mynewt-blinky... + Installing skeleton in myproj... + Project myproj successfully created. + + $<span style="color: #000000">cd</span> myproj + + $ newt install -v + apache-mynewt-core + Downloading repository description for apache-mynewt-core... success! + ... + apache-mynewt-core successfully installed version 0.7.9-none </pre></div> -<ul> -<li> -<p>Change directory to ~dev/larva directory and build the <em>blinky</em> project inside larva, using the <em>newt</em> tool. Starting with the target name, assign specific aspects of the project, as shown below, to pull the appropriate packages and build the right bundle or list for the board. For example, we set the architecture (arch), compiler, board support package (bsp), project, and compiler mode.</p> -<p>(Remember to prefix each command with "newtvm" if you are executing the newt command in a Linux virtual machine on your Windows box!)</p> -</li> -</ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target create blinky - Creating target blinky - Target blinky sucessfully created! - $ newt target set blinky arch=cortex_m4 - Target blinky successfully set arch to arm - $ newt target set blinky compiler=arm-none-eabi-m4 - Target blinky successfully set compiler to arm-none-eabi-m4 - $ newt target set blinky project=blinky - Target blinky successfully set project to blinky - $ newt target set blinky compiler_def=debug - Target blinky successfully set compiler_def to debug - $ newt target set blinky bsp=hw/bsp/olimex_stm32-e407_devboard - Target blinky successfully set bsp to hw/bsp/olimex_stm32-e407_devboard - $ newt target show blinky - blinky - arch=cortex_m4 - bsp=hw/bsp/olimex_stm32-e407_devboard - compiler=arm-none-eabi-m4 - compiler_def=debug - name=blinky - project=blinky +<p><br></p> +<h4 id="create-a-target">Create a target<a class="headerlink" href="#create-a-target" title="Permanent link">¶</a></h4> +<p>Change directory to ~/dev/core directory and define the <em>blinky</em> target inside core, using the <em>newt</em> tool. Starting with the target name, assign specific aspects of the project, as shown below, to pull the appropriate packages and build the right bundle or list for the board. For example, we set the build_profile, board support package (bsp), and app.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target create blinky + Target targets/blinky successfully created + $ newt target set blinky build_profile=debug + Target targets/blinky successfully set target.compiler_def to debug + $ newt target set blinky bsp=@apache-mynewt-core/hw/bsp/olimex_stm32-e407_devboard + Target targets/blinky successfully set target.bsp to ... + $ newt target set blinky app=@apache-mynewt-core/apps/blinky + Target targets/blinky successfully set target.app to apps/blinky + $ newt target show blinky + targets/boot_olimex + app=apps/blinky + bsp=hw/bsp/olimex_stm32-e407_devboard + build_profile=debug </pre></div> -<ul> -<li>Next, let's build the image with the above values assigned. By default, the linker script within the <code>hw/bsp/olimex_stm32-e407_devboard</code> package builds an image for flash memory, which we don't want; instead, we want an image for the SRAM, so you need to switch that script with <code>run_from_sram.ld</code>. </li> -</ul> +<p><br></p> +<h4 id="build-the-image">Build the image<a class="headerlink" href="#build-the-image" title="Permanent link">¶</a></h4> +<p>Next, let's build the image with the above values assigned. By default, the linker script within the <code>hw/bsp/olimex_stm32-e407_devboard</code> package builds an image for flash memory, which we don't want; instead, we want an image for the SRAM, so you need to switch that script with <code>run_from_sram.ld</code>. </p> <p><font color="red"> -(We are working to simplify this scheme whereby an executable for a project will correctly elect the linker scripts and generate the relevant image. For example, the scheme will key on project identity such as bootloader, RAM, Flash (default) and build accordingly. </font>.)</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">Afer you build the target, you can find the executable *blinky.elf* in the project directory *~/dev/larva/project/blinky/bin/blinky.* -</pre></div> - - -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard - $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld - (some diff will be displayed) - $ cp run_from_sram.ld olimex_stm32-e407_devboard.ld - $ cd ~/dev/larva/project/blinky/ - $ newt target build blinky - Building target blinky (project = blinky) - Compiling case.c - Compiling suite.c - ... - Successfully run! - $ ls bin/blinky - blinky.elf blinky.elf.bin blinky.elf.cmd blinky.elf.lst blinky.elf.map -</pre></div> - - -<ul> -<li>Check if you have all the scripts needed to launch OpenOCD and interact with the project's specific hardware. Depending on your system (Ubuntu or Windows) you may already have the scripts in your <em>/usr/share/openocd/scripts/</em> directory, as they may have been part of the openocd download. If they exist, you are all set and can proceed to prepare the hardware. Otherwise check the <em>~/dev/larva/hw/bsp/olimex_stm32-e407_devboard</em> directory for a file named <em>f407.cfg</em>. Used by OpenOCD, this config enables us to interact with this specific hardware. </li> -</ul> -<p>You are all set if you see the file.</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ ls ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard - bin include olimex_stm32-e407_devboard_download.sh run_from_loader.ld - boot-olimex_stm32-e407_devboard.ld olimex_stm32-e407_devboard.ld pkg.yml run_from_sram.ld - f407.cfg olimex_stm32-e407_devboard_debug.sh run_from_flash.ld src +(We are working to simplify this scheme whereby an executable for a project will correctly elect the linker scripts and generate the relevant image. For example, the scheme will key on project identity such as bootloader, RAM, Flash (default) and build accordingly.) </font>.</p> +<p>Afer you build the target, you can find the executable <em>blinky.elf</em> in the project directory <em>~/dev/core/bin/blinky/apps/blinky/.</em> </p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev/core/hw/bsp/olimex_stm32-e407_devboard + $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld + (some diff will be displayed) + $ cp run_from_sram.ld olimex_stm32-e407_devboard.ld + $ cd ~/dev/core + $ newt build blinky + Compiling case.c + Compiling suite.c + ... + Linking blinky.elf + App successfully built:~/dev/core/bin/blinky/apps/blinky/blinky.elf + $ ls bin/blinky/apps/blinky/ + blinky.elf blinky.elf.bin blinky.elf.cmd + blinky.elf.lst blinky.elf.map </pre></div> +<p><br></p> <h4 id="prepare-the-hardware-to-boot-from-embedded-sram">Prepare the hardware to boot from embedded SRAM<a class="headerlink" href="#prepare-the-hardware-to-boot-from-embedded-sram" title="Permanent link">¶</a></h4> <ul> -<li> -<p>Locate the boot jumpers on the board. -<img alt="Alt Layout - Top View" src="../pics/topview.png" /> +<li>Locate the boot jumpers on the board.</li> +</ul> +<p><br></p> +<p><img alt="Alt Layout - Top View" src="../pics/topview.png" /> <img alt="Alt Layout - Bottom View" src="../pics/bottomview.png" /></p> -</li> +<p><br></p> +<ul> <li> <p>B1_1/B1_0 and B0_1/B0_0 are PTH jumpers. Note that because the markings on the board may not always be accurate, when in doubt, you should always refer to the manual for the correct positioning. Since the jumpers are a pair, they should move together, and as such, the pair is responsible for the boot mode when bootloader is present. To locate the bootloader, the board searches in three places: User Flash Memory, System Memory or the Embedded SRAM. For this Blinky project, we will configure it to boot from SRAM by jumpering <strong>B0_1</strong> and <strong>B1_1</strong>.</p> @@ -580,44 +573,44 @@ To locate the bootloader, the board searches in three places: User Flash Memory, <p>Connect the JTAG connector to the SWD/JTAG interface on the board. The other end of the cable should be connected to the USB port or hub of your computer.</p> </li> </ul> +<p><br></p> <h4 id="lets-go">Let's Go!<a class="headerlink" href="#lets-go" title="Permanent link">¶</a></h4> <ul> <li>Ensure that you are in the blinky project directory with the <em>blinky.elf</em> executable. Run the debug command in the <em>newt</em> tool. You'll see some status messages as shown below. In case you need to halt the debugging session, you can issue an <code>-c "reset halt"</code> command.</li> </ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev/larva/project/blinky/bin/blinky - $ newt target debug blinky - Debugging with /Users/aditihilbert/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh blinky - Debugging /Users/aditihilbert/dev/larva/project/blinky/bin/blinky/blinky.elf - GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs - Copyright (C) 2014 Free Software Foundation, Inc. - License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> - ... - (info) - ... - target state: halted - target halted due to debug-request, current mode: Thread - xPSR: 0x01000000 pc: 0x20000250 msp: 0x10010000 - Info : accepting 'gdb' connection from 3333 - Info : device id = 0x10036413 - Info : flash size = 1024kbytes - Reset_Handler () at startup_STM32F40x.s:199 - 199 ldr r1, =__etext +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev/core + $ newt debug blinky + Debugging with ~/dev/core/hw/bsp/olimex_... + Debugging ~/dev/core/project/blinky/bin/blinky/blinky.elf + GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs + Copyright (C) 2014 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 <http://gnu.org/licenses/gpl.html> + ... + (info) + ... + target state: halted + target halted due to debug-request, current mode: Thread + xPSR: 0x01000000 pc: 0x080003c0 msp: 0x10010000 + Info : accepting 'gdb' connection on tcp/3333 + Info : device id = 0x10036413 + Info : flash size = 1024kbytes </pre></div> -<p>Check the value of the msp (main service pointer) register. If it is not 0x10010000 as indicated above, you will have to manually set it after you open the gdp tool and load the image on it. For example, </p> +<p><br></p> +<p>Check the value of the msp (main service pointer) register. If it is not 0x10010000 as indicated above, you will have to manually set it after you open the gdb tool and load the image on it. For example, </p> <div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> (gdb) set $<span style="color: #000000">msp</span>=0x10010000 </pre></div> +<p><br></p> <p>Now load the image and type "c" or "continue" from the GNU debugger. </p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> (gdb) load ~/dev/larva/project/blinky/bin/blinky/blinky.elf - Loading section .text, size 0x4294 lma 0x20000000 - Loading section .ARM.extab, size 0x24 lma 0x20004294 - Loading section .ARM.exidx, size 0xd8 lma 0x200042b8 - Loading section .data, size 0x874 lma 0x20004390 - Start address 0x20000250, load size 19460 - Transfer rate: 81 KB/sec, 2432 bytes/write. +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> (gdb) load ~/dev/core/bin/blinky/apps/blinky/blinky.elf + Loading section .text, size 0x16b88 lma 0x20000000 + Loading section .ARM.exidx, size 0x18 lma 0x20016b88 + Loading section .data, size 0x9ec lma 0x20016ba0 + Start address 0x200004b8, load size 95628 + Transfer rate: 74 KB/sec, 3825 bytes/write. (gdb) c Continuing. </pre></div> @@ -626,156 +619,133 @@ To locate the bootloader, the board searches in three places: User Flash Memory, <ul> <li>Voilà ! The board's LED should be blinking at 1 Hz. Success!</li> </ul> +<p><br></p> <h3 id="use-flash-to-make-led-blink">Use flash to make LED blink<a class="headerlink" href="#use-flash-to-make-led-blink" title="Permanent link">¶</a></h3> <p>If you wish to build the image to run from the onboard flash memory on Olimex board, follow the steps below:</p> <ul> -<li>Configure the board to boot from flash by moving the two jumpers together to <strong>B0_0</strong> and <strong>B1_0</strong>. Refer to the pictures of the board under the section titled <a href="#prepare-the-hardware-to-boot-from-embedded-sram">"Prepare the hardware to boot from embedded SRAM"</a>.</li> -</ul> +<li> +<p>Configure the board to boot from flash by moving the two jumpers together to <strong>B0_0</strong> and <strong>B1_0</strong>. Refer to the pictures of the board under the section titled <a href="#prepare-the-hardware-to-boot-from-embedded-sram">"Prepare the hardware to boot from embedded SRAM"</a>.</p> <p>You will have to reset the board once the image is uploaded to it.</p> -<ul> -<li>If you skipped the first option for the project <a href="#use-sram-to-make-led-blink">(downloading an image to SRAM)</a>, then skip this step. Otherwise, continue with this step. </li> +</li> +<li> +<p>If you skipped the first option for the project <a href="#use-sram-to-make-led-blink">(downloading an image to SRAM)</a>, then skip this step. Otherwise, continue with this step. </p> +</li> </ul> <p>By default, the linker script (<code>olimex_stm32-e407_devboard.ld</code>) is configured to run from bootloader and flash. However, if you first ran the image from SRAM you had changed <code>olimex_stm32-e407_devboard.ld</code> to match <code>run_from_sram.ld</code>. You will, therefore, return to defaults with <code>olimex_stm32-e407_devboard.ld</code> linker script matching the contents of 'run_from_loader.ld'. Return to the project directory.</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard - $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld - $ diff olimex_stm32-e407_devboard.ld run_from_loader.ld - (some diff will be displayed) - $ cp run_from_loader.ld olimex_stm32-e407_devboard.ld - $ cd ~/dev/larva/project/blinky/bin/blinky +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev/core/hw/bsp/olimex_stm32-e407_devboard + $ diff olimex_stm32-e407_devboard.ld run_from_sram.ld + $ diff olimex_stm32-e407_devboard.ld run_from_loader.ld + (some diff will be displayed) + $ cp run_from_loader.ld olimex_stm32-e407_devboard.ld + $ cd ~/dev/core </pre></div> +<p><br></p> <ul> -<li>In order to run the image from flash, you need to build the bootloader as well. The bootloader does the initial set up of the Olimex board and then transfers control to the image stored at a location in flash known to it. The bootloader in turn requires the <em>bin2image</em> tool to check the image header for version information, CRC checks etc. So, we will need to build these two additional targets (bootloader and bin2img).</li> +<li>In order to run the image from flash, you need to build the bootloader as well. The bootloader does the initial set up of the Olimex board and then transfers control to the image stored at a location in flash known to it. </li> </ul> -<p>Let's first create bin2img:</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target create bin2img - Creating target bin2img - Target bin2img successfully created! - $ newt target set bin2img arch=sim - Target bin2img successfully set arch to sim - $ newt target set bin2img compiler=sim - Target bin2img successfully set compiler to sim - $ newt target set bin2img project=bin2img - Target bin2img successfully set project to bin2img - $ newt target set bin2img compiler_def=debug - Target bin2img successfully set compiler_def to debug - $ newt target set bin2img bsp=hw/bsp/native - Target bin2img successfully set bsp to hw/bsp/native - $ newt target show bin2img - bin2img - arch=sim - bsp=hw/bsp/native - compiler=sim - compiler_def=debug - name=bin2img - project=bin2img -</pre></div> - - -<p>And then let's create boot_olimex:</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target create boot_olimex - Creating target boot_olimex - Target boot_olimex successfully created! - $ newt target set boot_olimex arch=cortex_m4 - Target boot_olimex successfully set arch to cortex_m4 - $ newt target set boot_olimex compiler=arm-none-eabi-m4 - Target boot_olimex successfully set compiler to arm-none-eabi-m4 - $ newt target set boot_olimex project=boot - Target boot_olimex successfully set project to boot - $ newt target set boot_olimex compiler_def=optimized - Target boot_olimex successfully set compiler_def to optimized - $ newt target set boot_olimex bsp=hw/bsp/olimex_stm32-e407_devboard - Target boot_olimex successfully set bsp to hw/bsp/olimex_stm32-e407_devboard - $ newt target show boot_olimex - boot_olimex - arch=cortex_m4 - bsp=hw/bsp/olimex_stm32-e407_devboard - compiler=arm-none-eabi-m4 - compiler_def=optimized - name=boot_olimex - project=boot +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%">Let's create boot_olimex: + +```no-highlight + $ newt target create boot_olimex + Creating target boot_olimex + Target boot_olimex successfully created! + $ newt target set boot_olimex build_profile=optimized + Target boot_olimex successfully set compiler_def to optimized + $ newt target set boot_olimex @apache-mynewt-core/hw/bsp/olimex_stm32-e407_devboard + Target boot_olimex successfully set bsp to ... + $ newt target set boot_olimex app=@apache-mynewt-core/apps/boot + Target targets/boot_olimex successfully set target.app to apps/boot + $ newt target show boot_olimex + targets/boot_olimex + app=app=@apache-mynewt-core/apps/boot + bsp=@apache-mynewt-core/hw/bsp/olimex_stm32-e407_devboar + build_profile=optimized </pre></div> +<p><br></p> <ul> -<li>Now let's build all the three targets now.</li> +<li>Now let's build both targets now.</li> </ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target build bin2img - Building target bin2img (project = bin2img) - Building project bin2img - ... - Successfully run! - $ newt target build boot_olimex - Building target boot_olimex (project = boot) - Building project boot - ... - Successfully run! - $ newt target build blinky - Building target blinky (project = blinky) - Building project blinky - Successfully run! +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt build boot_olimex + ... + App successfully built: ~/dev/core/bin/boot_olimex/apps/boot/boot_olimex.elf + $ newt build blinky + ... + Linking blinky.elf + App successfully built: ~/dev/core/bin/blinky/apps/blinky/blinky.elf </pre></div> +<p><br></p> <ul> -<li>Go to the project directory and download the bootloader and the image to flash ... in a flash! </li> +<li>Create the blinky image and download the bootloader and the image to flash ... in a flash! +When creating an image, you can assign a version number to your image; here we use '1.2.3'</li> </ul> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ cd ~/dev/larva/project/blinky/bin/blinky - $ newt target download boot_olimex - Downloading with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh - $ newt target download blinky - Downloading with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_download.sh +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt create-image blinky 1.2.3 + App image successfully generated: ~/dev/core/bin/blinky/apps/blinky/blinky.img + Build manifest: ~/dev/core/bin/blinky/apps/blinky/manifest.json + $ newt load boot_olimex + Downloading ~/dev/core/bin/boot_olimex/apps/boot/boot.elf.bin to 0x08000000 + Open On-Chip Debugger 0.9.0 (2015-11-15-13:10) + ... + shutdown command invoked + $ newt load blinky + Downloading ~/dev/core/bin/blinky/apps/blinky/blinky.img to 0x08020000 + Open On-Chip Debugger 0.9.0 (2015-11-15-13:10) + ... + shutdown command invoked </pre></div> +<p><br></p> <ul> -<li> -<p>Voilà ! The LED should be blinking! Success!</p> -</li> -<li> -<p>But wait...not so fast. let's double check that it is indeed booting from flash and making the LED blink from the image in flash. Pull the USB cable off the Olimex JTAG adaptor, severing the debug connection to the JTAG port. Next power off the Olimex board by pulling out the USB cable from the board. Wait for a couple of seconds and plug the USB cable back to the board. </p> -</li> +<li>Voilà ! The LED should be blinking! Success!</li> </ul> +<p><br></p> +<p><strong>But wait...not so fast.</strong> Let's double check that it is indeed booting from flash and making the LED blink from the image in flash. Pull the USB cable off the Olimex JTAG adaptor, severing the debug connection to the JTAG port. Next power off the Olimex board by pulling out the USB cable from the board. Wait for a couple of seconds and plug the USB cable back to the board. </p> <p>The LED light will start blinking again. Success!</p> -<p>Note #1: If you want to download the image to flash and a gdb session opened up, use <code>newt target debug blinky</code> instead of <code>newt target download blinky</code>.</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt target debug blinky - Debugging with ~/dev/larva/hw/bsp/olimex_stm32-e407_devboard/olimex_stm32-e407_devboard_debug.sh blinky - Debugging ~/dev/larva/project/blinky/bin/blinky/blinky.elf - GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs - Copyright (C) 2014 Free Software Foundation, Inc. - License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> - ... - (info) - ... - target state: halted - target halted due to debug-request, current mode: Thread - xPSR: 0x01000000 pc: 0x08000250 msp: 0x10010000 - Info : accepting 'gdb' connection from 3333 - Info : device id = 0x10036413 - Info : flash size = 1024kbytes - Reset_Handler () at startup_STM32F40x.s:199 - 199 ldr r1, =__etext - (gdb) +<p><strong>Note #1:</strong> If you want to download the image to flash and a gdb session opened up, use <code>newt debug blinky</code> after <code>newt download blinky</code>.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> $ newt debug blinky + Debugging with ~/dev/core/hw/bsp/olimex_stm32-e407_... + Debugging ~/dev/core/project/blinky/bin/blinky/blinky.elf + GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs + Copyright (C) 2014 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 <http://gnu.org/licenses/gpl.html> + ... + (info) + ... + target state: halted + target halted due to debug-request, current mode: Thread + xPSR: 0x01000000 pc: 0x08000250 msp: 0x10010000 + Info : accepting 'gdb' connection from 3333 + Info : device id = 0x10036413 + Info : flash size = 1024kbytes + Reset_Handler () at startup_STM32F40x.s:199 + 199 ldr r1, =__etext + (gdb) </pre></div> -<p>Note #2: If you want to erase the flash and load the image again you may use the following commands from within gdb. <code>flash erase_sector 0 0 x</code> tells it to erase sectors 0 through x. When you ask it to display (in hex notation) the contents of the sector starting at location 'lma,' you should see all f's. The memory location 0x8000000 is the start or origin of the flash memory contents and is specified in the olimex_stm32-e407_devboard.ld linker script. The flash memory locations is specific to the processor.</p> -<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> (gdb) monitor flash erase_sector 0 0 4 - erased sectors 0 through 4 on flash bank 0 in 2.296712s - (gdb) monitor mdw 0x08000000 16 - 0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff - (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff - (0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff - (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff - (gdb) monitor flash info 0 +<p><br></p> +<p><strong>Note #2:</strong> If you want to erase the flash and load the image again you may use the following commands from within gdb. <code>flash erase_sector 0 0 x</code> tells it to erase sectors 0 through x. When you ask it to display (in hex notation) the contents of the sector starting at location 'lma,' you should see all f's. The memory location 0x8000000 is the start or origin of the flash memory contents and is specified in the olimex_stm32-e407_devboard.ld linker script. The flash memory locations is specific to the processor.</p> +<div class="codehilite" style="background: #ffffff"><pre style="line-height: 125%"> (gdb) monitor flash erase_sector 0 0 4 + erased sectors 0 through 4 on flash bank 0 in 2.296712s + (gdb) monitor mdw 0x08000000 16 + 0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff + (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff + (0x08000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff + (0x08000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff + (gdb) monitor flash info 0 </pre></div> <h3 id="conclusion">Conclusion<a class="headerlink" href="#conclusion" title="Permanent link">¶</a></h3> -<p>Congratulations! You have now tried out a project on actual hardware. If this is your first time to embedded systems, this must feel like the best hands-on and low-level "Hello World" progam ever. </p> +<p>Congratulations! You have now tried out a project on actual hardware. If this is your first time to embedded systems, this must feel like the best hands-on and low-level "Hello World" program ever. </p> <p>Good, we have more fun tutorials for you to get your hands dirty. Be bold and try other Blinky-like <a href="../nRF52/">tutorials</a>.</p> -<p>If you see anything missing or want to send us feeback, please do so by signing up for appropriate mailing lists on our <a href="../../../community/">Community Page</a></p> +<p>If you see anything missing or want to send us feedback, please do so by signing up for appropriate mailing lists on our <a href="../../../community/">Community Page</a></p> <p>Keep on hacking and blinking!</p> <div class="row"> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/477d85dc/os/tutorials/pics/bottomview.png ---------------------------------------------------------------------- diff --git a/os/tutorials/pics/bottomview.png b/os/tutorials/pics/bottomview.png index fb7bf0a..c50a461 100644 Binary files a/os/tutorials/pics/bottomview.png and b/os/tutorials/pics/bottomview.png differ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/477d85dc/os/tutorials/pics/topview.png ---------------------------------------------------------------------- diff --git a/os/tutorials/pics/topview.png b/os/tutorials/pics/topview.png index e57995e..e889ee0 100644 Binary files a/os/tutorials/pics/topview.png and b/os/tutorials/pics/topview.png differ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/477d85dc/sitemap.xml ---------------------------------------------------------------------- diff --git a/sitemap.xml b/sitemap.xml index 6db8bff..bd308a7 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,7 +4,7 @@ <url> <loc>http://mynewt.apache.org/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -12,7 +12,7 @@ <url> <loc>http://mynewt.apache.org/about/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -20,7 +20,7 @@ <url> <loc>http://mynewt.apache.org/documentation/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -28,7 +28,7 @@ <url> <loc>http://mynewt.apache.org/download/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -36,7 +36,7 @@ <url> <loc>http://mynewt.apache.org/community/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -44,7 +44,7 @@ <url> <loc>http://mynewt.apache.org/events/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -53,7 +53,7 @@ <url> <loc>http://mynewt.apache.org/os/get_started/introduction/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -93,7 +93,7 @@ <url> <loc>http://mynewt.apache.org/newt/newt_intro/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -115,7 +115,7 @@ <url> <loc>http://mynewt.apache.org/newtmgr/overview/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url> @@ -137,7 +137,7 @@ <url> <loc>http://mynewt.apache.org/faq/answers/</loc> - <lastmod>2016-03-15</lastmod> + <lastmod>2016-03-16</lastmod> <changefreq>daily</changefreq> </url>
