HTTP Tools setup
Native compilers and build tools
GCC
The GNU Compiler Collection is a set of compilers supporting diverse architectures. Here we focus on the native compiler to build and run Mongoose and its examples on our workstation, with our OS of choice.
Linux
We assume you are using a Debian-based distribution like Ubuntu. Here you most likely need to install the build-essential
package:
$ sudo apt-get install build-essential
In RPM-based distributions like RHEL you usually have separate RPM packages for different compilers or can install the "Development Tools" group of tools (this usually means writing something like dnf groupinstall "Development Tools")
Mac
Windows: MinGW-W64
MinGW-W64, is a minimal set of GNU tools for Windows. It provides the GNU compiler collection (GCC), GNU Make, the debugger (GDB) and other assorted tools.
You can install it directly or as part of MSYS2, here we will go the direct path
We assume you are using a 64-bit installation of Windows 10
Downloading
The project download page has plenty of options, it even makes it confusing. However, the Windows builds Github repository README page has a link to an installer that will make it quite easier. Just download the installer.

Installing
Run the installer, and select:
- the GCC version, usually a stable latest
- the architecture: this means what type of code we want to generate, choose
64-bit
- the thread model: this only applies if you will be writing multi-threaded code. If you feel comfortable working with POSIX calls (as in Linux), then choose the
posix
model, otherwise, if you are used towin32
calls, then choose that model.
Then pick your installation directory; it defaults to your user directory and it is really not important, either the Desktop icon or the Start menu entry will solve the path issue
Using it
Double click the Desktop icon or select the entry in the Start menu, it will open a prompt with the path to the tools properly set.
>gcc --version
gcc (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Most Makefiles in Mongoose examples have been written for Linux/Mac environments; though the build actions should work on Windows with minimal changes.
- Instead of make call
mingw32-make
- As cc has no meaning in Windows, you need to call
mingw32-make CC=gcc
- You need to add
-lws2_32
to the gcc link flags, in order to link the Winsock32 library. In most examples, this means addingEXTRA_CFLAGS=-lws2_32
>mingw32-make all CC=gcc EXTRA_CFLAGS=-lws2_32
GNU Make
GNU Make is a tool that processes a recipe file (Makefile) in order to know how to build a piece of software. Recipes can be super simple or quite complex, the main idea is to indicate the dependencies and how to compile and link, then Make takes care of the necessary steps when something changes.
Linux
We assume you are using a Debian-based distribution like Ubuntu. Here you most likely need to install the build-essential
package:
$ sudo apt-get install build-essential
In RPM-based distributions like RHEL you usually have the make RPM package or can install the "Development Tools" group of tools (this usually means writing something like dnf groupinstall "Development Tools")
Mac
Install Homebrew, the package manager, then install make
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install make
Windows
Your best bet, if you will also be compiling native code, is to use MinGW (see MinGW-W64 above), as it provides the latest version of make.
However, if you'll only be working with embedded and just need make and not a native compiler, you can download make-4.4-without-guile-w32-bin.zip and unpack bin/make.exe
into a directory of your choice, then add that directory to the PATH environment variable
Cross compilers
ARM GCC
The ARM GCC toolchain is maintained by ARM, they provide frequent updates based on corresponding versions of GCC, the GNU Compiler Collection.
In general, the Makefile will default to using Docker and take advantage of an image we've built just for this purpose. If you are using a Linux/Mac workstation, you just need to have Docker installed, and your user has to be able to run it. If in doubt, check:
$ docker ps
If you fall into this category, you don't need to do anything else, nor keep reading this section, unless of course you want to.
If you are using Windows, or want to run your local ARM toolchain, just append DOCKER=
to the make commands shown in the README file or the tutorial.
Linux
We assume you are using a Debian-based distribution like Ubuntu, on x86-64 hardware; but since we don't use any package installation functions, this applies to probably all Linux distributions. We also assume you are using bash as your shell. For workstations based on other hardware, just pick the suitable compiler version.
Downloading
The download page has plenty of options, so make sure you pick the right one for your platform and environment. We prefer stable versions, pick a Linux-hosted cross toolchain for the AArch-32 architecture on bare metal: arm-none-eabi

Installing
You can actually install it wherever you want, including on your own home directory. Here we assume you'll install for all users and use /opt
as destination; just make necessary changes if you don't.
$ cd /opt
$ sudo tar xf /path/to/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz
Setting the PATH variable
You don't actually need to do this, as you can always manually invoke the compiler by using the full path to it, but since Makefiles assume the compiler binary is in your path, it is convenient to add it. Just append the path to the installation bin folder to your PATH variable:
$ export PATH=$PATH:/opt/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi/bin
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arm GNU Toolchain 11.3.Rel1) 11.3.1 20220712
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To make this permanent, add it to your .bash_profile
file.
Mac
Install Homebrew, the package manager, then install gcc-arm-embedded
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install gcc-arm-embedded
Windows
We assume you are using a 64-bit installation of Windows 10 on x86-64 hardware
Downloading
The download page has plenty of options, so make sure you pick the right one for your platform and environment. We prefer stable versions, pick a Windows-hosted cross toolchain for the AArch-32 architecture on bare metal: arm-none-eabi
and download an installer so we won't have any post-install duties.

Installing
The installer will take care of everything, just accept the license and the defaults, and mark "Add path to environment variable"; it will add the compiler binaries path to your user path

Flashing/Debugging tools
stlink
stlink is an open source toolset for STM32 devices.
Linux
We assume you are using a Debian-based distribution like Ubuntu, on x86-64 hardware; we also assume you are using bash as your shell. The maintainers recommend installing stlink-tools
from the distribution package repository; however, for the most used ones they recommend to download and manually install the latest packages.
For workstations based on other hardware, just pick the source code and follow the compile instructions.
Download and install
The releases page contains several options, pick the .deb
package

Then install using apt
$ sudo apt install /path/to/stlink_1.7.0-1_amd64.deb
For RPM-based distributions, try the RPM package or build from source.

Mac
Install Homebrew, the package manager, then install stlink
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install stlink
Windows
We assume you are using a 64-bit installation of Windows 10 on x86-64 hardware
Download and install
The releases page contains several options, pick the x86_64
.zip
package and extract it wherever you like. The authors suggest putting it in C:\Program Files (x86)\
as it is a 32-bit application.

Setting the PATH variable
You don't actually need to do this, as you can always manually invoke the application by using the full path to it, but it is convenient to add it. Just append the path to the installation bin folder to your PATH variable:
- Right-click on the Start button and select
System
in the menu. Then click onAdvanced system settings
, then select theAdvanced
tab and click onEnvironment Variables
. Either select the system variable namedPath
(do this for all users) or the user variable namedPATH
(do this just for your user), and clickEdit
.
Driver issues
With libusb-based applications, you'll likely need to install WinUSB or libusb-win32 so this application can communicate with the device. Your best bet is to install Zadig; it will detect the device missing a driver and let you install a proper one. Try WinUSB first.
