<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Building the firmware from source]]></title><description><![CDATA[<p dir="auto">This tutorial explains the setup required to build the firmware from the GitHub source repository <a href="https://github.com/sg-wireless/sg-sdk" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/sg-wireless/sg-sdk</a></p>
<p dir="auto">In this tutorial, I am using Windows 11 with Ubuntu 24.04 installed via WSL (<a href="https://learn.microsoft.com/en-us/windows/wsl/about" target="_blank" rel="noopener noreferrer nofollow ugc">Windows Subsystem for Linux</a>). You can also use Ubuntu 24.04 or MacOS directly. If using Ubuntu 22.04, please see the note below regarding cmake.</p>
<p dir="auto"><strong>Step1</strong>: Install necessary packages via apt</p>
<pre><code>sudo apt-get install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 python3-venv python3-toml python3-virtualenv
</code></pre>
<p dir="auto"><strong>Step2</strong>: Clone the SG Wireless Open Source SDK</p>
<pre><code>git clone https://github.com/sg-wireless/sg-sdk.git
</code></pre>
<p dir="auto"><strong>Step3</strong>: Build the firmware</p>
<pre><code>cd sg-sdk &amp;&amp; ./fw_builder.sh --board SGW3501-F1-StarterKit build
</code></pre>
<p dir="auto">During the first compilation, you will eventually get an error when using the latest version of Ubuntu 24.04:</p>
<pre><code>../py/stackctrl.c: In function ‘mp_stack_ctrl_init’:
../py/stackctrl.c:32:32: error: storing the address of local variable ‘stack_dummy’ in ‘mp_state_ctx.thread.stack_top’ [-Werror=dangling-pointer=]
   32 |     MP_STATE_THREAD(stack_top) = (char *)&amp;stack_dummy;
../py/stackctrl.c:31:18: note: ‘stack_dummy’ declared here
   31 |     volatile int stack_dummy;
      |                  ^~~~~~~~~~~
In file included from ../py/runtime.h:29,
                 from ../py/stackctrl.c:27:
../py/mpstate.h:291:23: note: ‘mp_state_ctx’ declared here
  291 | extern mp_state_ctx_t mp_state_ctx;
      |                       ^~~~~~~~~~~~
cc1: all warnings being treated as errors
-e See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make: *** [../py/mkrules.mk:83: build/py/stackctrl.o] Error 1
make: Leaving directory '/home/ehlers/sg-sdk/ext/micropython/mpy-cross'
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
build failed!
</code></pre>
<p dir="auto">Please edit the file <code>ext/micropython/mpy-cross/Makefile</code> and change line 20 to read:<br />
<code>CWARN = -Wall</code> (remove -Werror)</p>
<p dir="auto">Now you can run <code> ./fw_builder.sh --board SGW3501-F1-StarterKit build</code> again</p>
<p dir="auto">The firmware team is aware of this issue and it is already fixed in a newer version of Micropython. We will provide an update on this when the team has implemented the necessary update to support newer version of Micropython.</p>
<p dir="auto"><strong>Step4</strong>: Flashing the firmware</p>
<p dir="auto">If you are using Ubuntu Linux natively on your PC, you can simply connect the Starter Kit and run:</p>
<pre><code>./fw_builder.sh --board SGW3501-F1-StarterKit flash --port /dev/ttyUSB0
</code></pre>
<p dir="auto">If you are using WSL, I suggest installing <a href="https://gitlab.com/alelec/wsl-usb-gui" target="_blank" rel="noopener noreferrer nofollow ugc">wsl-usb-gui</a></p>
<p dir="auto"><img src="/assets/uploads/files/1736537297428-c90bff24-431a-4d51-a8ea-071f259ce6a6-image.png" alt="c90bff24-431a-4d51-a8ea-071f259ce6a6-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Select the entry with “Silicon Labs CP210x USB to UART Bridge (COMx)” that corresponds to the board you want to flash. In the screenshot above, I have two Starter Kits connected to my PC.</p>
<p dir="auto">Once the device is attached to the WSL subsystem, you can flash it with the same command as above:</p>
<pre><code>./fw_builder.sh --board SGW3501-F1-StarterKit flash --port /dev/ttyUSB0
</code></pre>
<p dir="auto"><strong>Note</strong>: On older versions of Ubuntu (ex: 22.04), the version of cmake installed with apt is too old. You can install a newer version by running:</p>
<pre><code>sudo apt-get install python3-pip &amp;&amp; pip3 install -U cmake
</code></pre>
<p dir="auto">Please make sure you add the PATH where cmake is installed:</p>
<pre><code>export PATH=~/.local/bin:$PATH
</code></pre>
<p dir="auto">Please let me know if you experience any issues with building the firmware.</p>
]]></description><link>https://forum.sgwireless.com/topic/22/building-the-firmware-from-source</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Jul 2026 21:14:14 GMT</lastBuildDate><atom:link href="https://forum.sgwireless.com/topic/22.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Jan 2025 19:33:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Building the firmware from source on Fri, 07 Nov 2025 13:55:31 GMT]]></title><description><![CDATA[<p dir="auto">You can reset the devnonce on TTN (or even set it to be ignored). Go to the end devices section on TTN, open the end device affected, go to settings and scroll down all the way to join settings and click expand.</p>
<p dir="auto"><img src="/assets/uploads/files/1762523503402-78deea47-477d-4c49-bc64-527613dbd461-image.png" alt="image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">The devnonce is stored in the nvs partition, which is normally not erased when just flashing a firmware update. But if the board is erased completely then the last devnonce used is also erased.</p>
]]></description><link>https://forum.sgwireless.com/post/96</link><guid isPermaLink="true">https://forum.sgwireless.com/post/96</guid><dc:creator><![CDATA[cehlers]]></dc:creator><pubDate>Fri, 07 Nov 2025 13:55:31 GMT</pubDate></item><item><title><![CDATA[Reply to Building the firmware from source on Fri, 07 Nov 2025 11:28:41 GMT]]></title><description><![CDATA[<p dir="auto">Ok. the problem is that resetting the firmware also reset the nonce sent from the Lora to the TTS server and the server refuse the join because the nonce now is lower than that in the server db…</p>
]]></description><link>https://forum.sgwireless.com/post/95</link><guid isPermaLink="true">https://forum.sgwireless.com/post/95</guid><dc:creator><![CDATA[SicheoSrl]]></dc:creator><pubDate>Fri, 07 Nov 2025 11:28:41 GMT</pubDate></item><item><title><![CDATA[Reply to Building the firmware from source on Fri, 07 Nov 2025 09:59:01 GMT]]></title><description><![CDATA[<p dir="auto">I was testing my F1 starter kit since May. everything worked fine (LTE, Lora).<br />
Yesterday I made a complete erase of flash (because the board was hanging) with</p>
<p dir="auto">./fw_builder.sh --board SGW3501-F1-StarterKit flash --port /dev/ttyUSB0</p>
<p dir="auto">and reflash teh firmware with</p>
<p dir="auto">./fw_builder.sh --board SGW3501-F1-StarterKit flash --port /dev/ttyUSB0</p>
<p dir="auto">from then on the Lora radio was unable to join…do have I erased some Lora parameter?</p>
]]></description><link>https://forum.sgwireless.com/post/94</link><guid isPermaLink="true">https://forum.sgwireless.com/post/94</guid><dc:creator><![CDATA[SicheoSrl]]></dc:creator><pubDate>Fri, 07 Nov 2025 09:59:01 GMT</pubDate></item><item><title><![CDATA[Reply to Building the firmware from source on Sat, 17 May 2025 07:00:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/cehlers" aria-label="Profile: cehlers"><bdi>cehlers</bdi></a><br />
Thanks for the great tutorial<img src="https://forum.sgwireless.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f600.png?v=9a9dd39c41e" class="not-responsive emoji emoji-android emoji--grinning" style="height:23px;width:auto;vertical-align:middle" title="😀" alt="😀" /><br />
I did hit one strange error as below</p>
<pre><code>CMake Error at /home/rmg/repos/sg-sdk/ext/esp-idf/components/mbedtls/mbedtls/CMakeLists.txt:23 (cmake_minimum_required):
  Compatibility with CMake &lt; 3.5 has been removed from CMake.

  Update the VERSION argument &lt;min&gt; value.  Or, use the &lt;min&gt;...&lt;max&gt; syntax
  to tell CMake that the project requires at least &lt;min&gt; but has been updated
  to work with policies introduced by &lt;max&gt; or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.
</code></pre>
<p dir="auto">My cmake version was 4.0.2. so I edited line 23 of CMakeLists.txt to</p>
<pre><code>cmake_minimum_required(VERSION 3.5)
</code></pre>
<p dir="auto">and everything worked<img src="https://forum.sgwireless.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f601.png?v=9a9dd39c41e" class="not-responsive emoji emoji-android emoji--grin" style="height:23px;width:auto;vertical-align:middle" title="😁" alt="😁" /></p>
<p dir="auto">I</p>
]]></description><link>https://forum.sgwireless.com/post/86</link><guid isPermaLink="true">https://forum.sgwireless.com/post/86</guid><dc:creator><![CDATA[rodgergr]]></dc:creator><pubDate>Sat, 17 May 2025 07:00:36 GMT</pubDate></item></channel></rss>