lupyuen.org/articles/install-apache-mynewt-on-windows.html

338 lines
27 KiB
HTML
Raw Normal View History

2021-02-23 20:05:19 +08:00
<!doctype html>
<html lang="en">
<head>
<script defer src="https://cdn.optimizely.com/js/16180790160.js"></script>
<title data-rh="true">Install Apache Mynewt for STM32 Blue Pill on Windows | by Lup Yuen Lee 李立源 | Medium</title>
<meta data-rh="true" charset="utf-8" />
<meta data-rh="true" name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" />
<meta data-rh="true" name="theme-color" content="#000000" />
<meta data-rh="true" property="og:type" content="article" />
<meta data-rh="true" property="article:published_time" content="2019-09-21T09:54:05.282Z" />
<meta data-rh="true" name="title"
content="Install Apache Mynewt for STM32 Blue Pill on Windows | by Lup Yuen Lee 李立源 | Medium" />
<meta data-rh="true" property="og:title" content="Install Apache Mynewt on Windows" />
<meta data-rh="true" property="twitter:title" content="Install Apache Mynewt on Windows" />
<meta data-rh="true" name="description"
content="Follow these instructions to install Mynewt build and application files on Windows" />
<meta data-rh="true" property="og:description"
content="Follow these instructions to install Mynewt build and application files on Windows" />
<meta data-rh="true" property="twitter:description"
content="Follow these instructions to install Mynewt build and application files on Windows" />
<meta data-rh="true" name="twitter:card" content="summary_large_image" />
<meta data-rh="true" name="twitter:creator" content="@MisterTechBlog" />
<meta data-rh="true" name="author" content="Lup Yuen Lee 李立源" />
<meta data-rh="true" name="robots" content="index,follow,max-image-preview:large" />
<meta data-rh="true" name="referrer" content="unsafe-url" />
<meta data-rh="true" name="twitter:label1" value="Reading time" />
<meta data-rh="true" name="twitter:data1" value="3 min read" />
2021-02-26 13:24:17 +08:00
<meta property="og:image"
content="https://lupyuen.github.io/images/legacy2/b1.jpeg">
2021-02-25 09:36:37 +08:00
<!-- Begin scripts/rustdoc-header.html: Header for Custom Markdown files processed by rustdoc, like chip8.md -->
<link rel="alternate" type="application/rss+xml" title="RSS Feed for lupyuen" href="/rss.xml" />
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle">
<link rel="stylesheet" type="text/css" href="../prism.css">
<script src="../storage.js"></script><noscript>
<link rel="stylesheet" href="../noscript.css"></noscript>
<link rel="shortcut icon" href="../favicon.ico">
<style type="text/css">
#crate-search {
background-image: url("../down-arrow.svg");
}
a {
color: #77d;
}
</style>
<!-- End scripts/rustdoc-header.html -->
2021-02-23 20:05:19 +08:00
</head>
<body>
<div id="root">
<div class="a b c">
<div class="s">
<article>
<section class="ft fu fv fw w fx fd s"></section><span class="s"></span>
<div>
<div class="by fl fy fz ga ce"></div>
<section class="dj gb gc de gd">
<div class="ge w">
2021-02-25 21:05:13 +08:00
<div class="figure gf ge w paragraph-image">
2021-02-24 09:03:17 +08:00
<p><img src="https://lupyuen.github.io/images/legacy2/b1.jpeg" /></p>
2021-02-25 15:21:12 +08:00
2021-02-25 21:00:07 +08:00
<figcaption><p><em>STM32 Blue Pill with Quectel
BC95-G NB-IoT module running Apache Mynewt at Henderson Waves</em></p></figcaption>
2021-02-25 21:05:13 +08:00
</div>
2021-02-23 20:05:19 +08:00
</div>
<div class="n p">
<div class="aj ak al am an gz ap w">
<div class="">
<h1 id="2243"
class="ha dh hb av cw hc hd he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw el">
Install Apache Mynewt for STM32 Blue Pill on Windows</h1>
<div class="ct">
<div class="n cg hx hy hz">
<div class="o n">
<div><a rel="noopener"
2021-02-26 07:51:35 +08:00
href="https://lupyuen.github.io">
2021-02-23 20:05:19 +08:00
<div class="ah ia ib">
2021-02-25 22:31:47 +08:00
<div class="ba n ar o p by ic id cb cc cd ce"></div>
2021-02-23 20:05:19 +08:00
</div>
</a></div>
<div class="dp w n cq">
<div class="n">
<div style="flex:1"><span class="av b aw ax el"><a class=""
rel="noopener"
2021-02-26 07:51:35 +08:00
href="https://lupyuen.github.io">
2021-02-23 20:05:19 +08:00
<p class="av b aw ax az">Lup Yuen Lee 李立源</p>
</a></span></div>
</div><span class="av b aw ax ay"><a class="" rel="noopener"
2021-02-25 17:36:38 +08:00
href="https://lupyuen.github.io/articles/install-apache-mynewt-on-windows">
2021-02-23 20:05:19 +08:00
<p class="av b aw ax ay"><span class="ie"></span>Jul 25,
2019<span class="if">·</span>3 min read</p>
</a></span>
</div>
</div>
</div>
</div>
</div>
<p id="88c1"
class="iu iv hb iw b ix iy iz ja jb jc jd je jf jg jh ji jj jk jl jm jn dj el">
Follow these instructions to install Mynewt build and application files on
Windows for the article...</p>
<div class="jo jp jq jr js jt"><a target="_blank" rel="noopener"
2021-02-25 17:14:24 +08:00
href="https://lupyuen.github.io/articles/connect-stm32-blue-pill-to-nb-iot-with-quectel-bc95-g-and-apache-mynewt">
2021-02-23 20:05:19 +08:00
<div class="en n dq">
<div class="ju n ac p jv jw">
<h2 class="av cw dk ax ec jx eb jy jz ka kb dh el">Connect STM32
Blue Pill to NB-IoT with Quectel BC95-G and Apache Mynewt</h2>
</div>
<div class="kf s">
<div class="kg s kh ki kj kf kk kl jt"></div>
</div>
</div>
</a></div>
<p id="c1c6"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
1⃣ Download the <code class="gp kr ks kt ku b">.7z</code> file attached
below…<br /><code
class="gp kr ks kt ku b"><a href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/releases/tag/v5.0.0" class="bq kv" rel="noopener nofollow">https://github.com/lupyuen/stm32bluepill-mynewt-sensor/releases/tag/v5.0.0</a></code>
</p>
<p id="d698"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Expand the <code class="gp kr ks kt ku b">.7z</code> file with 7zip…<br /><code
class="gp kr ks kt ku b"><a href="https://www.7-zip.org/download.html" class="bq kv" rel="noopener nofollow">https://www.7-zip.org/download.html</a></code>
</p>
<p id="bef9"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
2⃣ Install Arm Cross-Compiler and Linker for Windows from Arm Developer
Website…<br /><code
class="gp kr ks kt ku b"> <a href="https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-win32-sha1.exe?revision=fcadabed-d946-49dc-8f78-0732d2f43773?product=GNU%20Arm%20Embedded%20Toolchain,32-bit,,Windows,8-2019-q3-update" class="bq kv" rel="noopener nofollow">https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-win32-sha1.exe?revision=fcadabed-d946-49dc-8f78-0732d2f43773?product=GNU%20Arm%20Embedded%20Toolchain,32-bit,,Windows,8-2019-q3-update</a></code>
</p>
<p id="cee4"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Select this option at the last install step:<br /><code
class="gp kr ks kt ku b">&quot;Add path to environment variable&quot;</code>
</p>
<p id="d593"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
3⃣ Download the ST-Link USB driver from ST-Link Driver Website (email
registration required)…<br /><code
class="gp kr ks kt ku b"><a href="https://www.st.com/en/development-tools/stsw-link009.html" class="bq kv" rel="noopener nofollow">https://www.st.com/en/development-tools/stsw-link009.html</a></code>
</p>
<p id="df02"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Click <code class="gp kr ks kt ku b">Get Software</code><br />Unzip the
downloaded file. Double-click the driver installer:<br /><code
class="gp kr ks kt ku b">dpinst_amd64.exe</code></p>
<p id="6385"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
4⃣ Install Windows Studio Code:<br /><code
class="gp kr ks kt ku b"><a href="https://code.visualstudio.com/" class="bq kv" rel="noopener nofollow">https://code.visualstudio.com/</a></code>
</p>
<p id="988f"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Launch Visual Studio Code</p>
<p id="a939"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Install the extension “<code
class="gp kr ks kt ku b">Cortex-Debug</code>”…<br /><code
class="gp kr ks kt ku b"><a href="https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug" class="bq kv" rel="noopener nofollow">https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug</a></code>
</p>
<p id="2ddb"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
5<span id="rmm"> </span>Click <code
class="gp kr ks kt ku b">File → Open Folder</code><br />Select the
downloaded folder <code
class="gp kr ks kt ku b">stm32bluepill-mynewt-sensor</code><br />When
prompted to open the workspace, click <code
class="gp kr ks kt ku b">Open Workspace</code></p>
<p id="b5fc"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Open the following file and configure the program settings:<br /><code
class="gp kr ks kt ku b"><a href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/targets/bluepill_my_sensor/syscfg.yml" class="bq kv" rel="noopener nofollow">targets/bluepill_my_sensor/syscfg.yml</a></code>
</p>
<p id="d03e"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Change the NB-IoT band setting <code class="gp kr ks kt ku b">NBIOT_BAND</code>.
Check with your NB-IoT operator for the band to use. The other settings are
documented below.</p>
<p id="830e"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
6⃣ Connect Blue Pill to ST-Link. Connect ST-Link to your computers USB port.
</p>
<p id="a141"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Click <code
class="gp kr ks kt ku b">Terminal → Run Task → [1] Build bluepill_boot</code><br />This
builds the Mynewt Bootloader. In case of problems, compare with <a
href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/logs/build-bootloader.log"
class="bq kv" rel="noopener nofollow">this build log</a>.</p>
<p id="6037"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Click <code
class="gp kr ks kt ku b">Terminal → Run Task → [2] Build bluepill_my_sensor</code><br />This
builds the Mynewt Application. Compare with <a
href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/logs/build-application.log"
class="bq kv" rel="noopener nofollow">this build log</a>.</p>
<p id="cf92"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Click <code
class="gp kr ks kt ku b">Terminal → Run Task → [3] Image bluepill_my_sensor</code><br />This
creates the Blue Pill flash image. Compare with <a
href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/logs/image.log"
class="bq kv" rel="noopener nofollow">this image log</a>.</p>
<p id="0ca7"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Click <code
class="gp kr ks kt ku b">Terminal → Run Task → [4] Load bluepill_boot</code><br />This
flashes the Mynewt Bootloader to Blue Pill. Compare with <a
href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/logs/load-bootloader.log"
class="bq kv" rel="noopener nofollow">this flash log</a>.</p>
<p id="2b6b"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Click <code
class="gp kr ks kt ku b">Terminal → Run Task → [5] Load bluepill_my_sensor</code><br />This
flashes the Mynewt Application to Blue Pill. Compare with <a
href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/logs/load-application.log"
class="bq kv" rel="noopener nofollow">this flash log</a>.</p>
<p id="46ab"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
If any source files or configuration files are changed, rebuild by clicking
<code
class="gp kr ks kt ku b">Terminal → Run Task → [2] Build bluepill_my_sensor</code>
</p>
<h1 id="0e7c"
class="kw kx hb av ky kz la iy lb lc ld jb le lf lg lh li lj lk ll lm ln lo lp lq lr el">
Program Settings</h1>
<p id="d1c0"
class="iu iv hb iw b ix ls iy iz ja lt jb jc jd lu je jf jg lv jh ji jj lw jk jl jn dj el">
The program settings may be found in the file<br /><code
class="gp kr ks kt ku b"><a href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/targets/bluepill_my_sensor/syscfg.yml" class="bq kv" rel="noopener nofollow">targets/bluepill_my_sensor/syscfg.yml</a></code>
</p>
2021-02-25 21:05:13 +08:00
<div class="figure lx ly lz ma mb ge mc md fc me mf mg mh mi bg mj mk ml mm mn dy">
2021-02-24 18:55:57 +08:00
2021-02-24 19:10:42 +08:00
<p><script src="https://gist.github.com/lupyuen/4165741d9c7832704545057b25e83ee9.js"></script></p>
2021-02-24 18:55:57 +08:00
2021-02-25 15:21:12 +08:00
2021-02-25 21:00:07 +08:00
<figcaption><p><em>Program Settings. From <a
2021-02-23 20:05:19 +08:00
href="https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/targets/bluepill_my_sensor/syscfg.yml"
class="bq kv"
rel="noopener nofollow">https://github.com/lupyuen/stm32bluepill-mynewt-sensor/blob/nbiot/targets/bluepill_my_sensor/syscfg.yml</a>
2021-02-25 21:00:07 +08:00
</em></p></figcaption>
2021-02-25 21:05:13 +08:00
</div>
2021-02-23 20:05:19 +08:00
<p id="b43e"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
<code class="gp kr ks kt ku b">COAP_HOST, COAP_PORT</code>: The program will
send CoAP messages to this IP address and port number, which defaults to the
CoAP server at thethings.io.</p>
<p id="5298"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Keep the default settings if you wish to view your sensor data at <code
class="gp kr ks kt ku b">blue-pill-geolocate.appspot.com</code>.</p>
<p id="c683"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Change the setting to use your own CoAP server instead of thethings.io</p>
<p id="8ce7"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
<code class="gp kr ks kt ku b">COAP_URI</code>: The CoAP message will be
delivered to this URI at the CoAP server (which defaults to thethings.io).</p>
<p id="2117"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
Keep the default settings if you wish to view your sensor data at <code
class="gp kr ks kt ku b">blue-pill-geolocate.appspot.com</code>.</p>
<p id="caff"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
For thethings.io, the last part <code class="gp kr ks kt ku b">IVRi…</code> is
the Thing Token. If you wish to send sensor data to your own Thing at
thethings.io, replace the last part of the URI with your Thing Token.</p>
<p id="86bd"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
For the purpose of NB-IoT Education, Ill allow you to transmit sensor data to
the Thing Token <code class="gp kr ks kt ku b">IVRi…</code> from my personal,
paid thethings.io account. Which will forward the sensor data to <code
class="gp kr ks kt ku b">blue-pill-geolocate.appspot.com</code> for viewing.
</p>
<p id="4572"
class="iu iv hb iw b ix km iy iz ja kn jb jc jd ko je jf jg kp jh ji jj kq jk jl jn dj el">
<code class="gp kr ks kt ku b">NBIOT_BAND</code>: The program connects to this
<a href="http://www.techplayon.com/nb-iot-frequency-bands-as-per-3gpp-rel-13-14-and-15/"
class="bq kv" rel="noopener nofollow">NB-IoT Frequency Band</a>. The
Frequency Band depends on your country and your NB-IoT network operator. Check
with your NB-IoT network operator for the Frequency Band to use.</p>
2021-02-25 21:05:13 +08:00
<div class="figure lx ly lz ma mb ge fv fw paragraph-image">
2021-02-24 09:53:26 +08:00
2021-02-25 08:36:07 +08:00
<p><img src="https://lupyuen.github.io/images/legacy2/b2.png" /></p>
2021-02-24 09:53:26 +08:00
2021-02-25 21:00:07 +08:00
<figcaption><p><em>NB-IoT Frequency Bands
2021-02-23 20:05:19 +08:00
for Singapore. From <a
href="https://www.imda.gov.sg/-/media/imda/files/regulation-licensing-and-consultations/frameworks-and-policies/spectrum-management-and-coordination/spectrummgmthb.pdf"
class="bq kv"
rel="noopener nofollow">https://www.imda.gov.sg/-/media/imda/files/regulation-licensing-and-consultations/frameworks-and-policies/spectrum-management-and-coordination/spectrummgmthb.pdf</a>
2021-02-25 21:00:07 +08:00
</em></p></figcaption>
2021-02-25 21:05:13 +08:00
</div>
<div class="figure lx ly lz ma mb ge fv fw paragraph-image">
2021-02-24 09:53:26 +08:00
2021-02-25 08:36:07 +08:00
<p><img src="https://lupyuen.github.io/images/legacy2/b3.png" /></p>
2021-02-24 09:53:26 +08:00
2021-02-25 15:21:12 +08:00
2021-02-25 21:00:07 +08:00
<figcaption><p><em>NB-IoT Frequency Bands
2021-02-23 20:05:19 +08:00
for Singapore. From <a
href="https://www.imda.gov.sg/-/media/imda/files/regulation-licensing-and-consultations/ict-standards/telecommunication-standards/radio-comms/imda-ts-iot.pdf"
class="bq kv"
rel="noopener nofollow">https://www.imda.gov.sg/-/media/imda/files/regulation-licensing-and-consultations/ict-standards/telecommunication-standards/radio-comms/imda-ts-iot.pdf</a>
2021-02-25 21:00:07 +08:00
</em></p></figcaption>
2021-02-25 21:05:13 +08:00
</div>
2021-02-23 20:05:19 +08:00
</div>
</div>
</section>
</div>
</article>
</div>
</div>
</div>
2021-02-26 20:10:47 +08:00
<ul>
<li>
<p><a href="https://github.com/sponsors/lupyuen">Sponsor me a coffee</a></p>
</li>
<li>
<p><a href="https://lupyuen.github.io">Check out my articles</a></p>
</li>
<li>
<p><a href="https://lupyuen.github.io/rss.xml">RSS Feed</a></p>
</li>
</ul>
</body>
2021-02-23 20:05:19 +08:00
</html>