1

Topic: looking for Cortex-M bare-metal example project

Hello!


we want to use wolfMQTT on bare-metal cortex-M. Connection should be using TLS.

An example project for any currently available cortex-M devkit would help a lot, as we never did anything with IP without an OS.
Linking with a IP-stack and configuring everything on our own seems to take a lot of time.

Any pointers greatly appreciated.


regards

Sebastian

Share

Re: looking for Cortex-M bare-metal example project

Hi Sebastian,

Yes it is very possible to do MQTTS on bare-metal.

Can you tell us more about the compiler/IDE, hardware and reason for bare-metal requirement? Have you selected a network stack and confirmed it can be used in bare-metal?

You might find this MQTT over UART example useful for understanding how to customize the network IO layer: https://github.com/wolfSSL/wolfMQTT/blo … mqttuart.c

The wolfSSL FAQ covers some useful topics like build configuration: https://www.wolfssl.com/docs/frequently … tions-faq/

For building wolfSSL (TLS) you just need to build with SINGLE_THREADED, NO_FILESYSTEM, etc...

Let me know if you have any specific questions or build issues.

Thanks,
David Garske, wolfSSL

Share

3 (edited by sf 2023-03-31 08:34:29)

Re: looking for Cortex-M bare-metal example project

Yes I know its possible.
But its hard to get right if you have never done it.
We are using NXP cortex-M0 right now for simple embedded devices (KNX-protocol-stack and GPIO is about all we do).
Now we want to bridge the KNX-Bus to MQTT (AWS IoT Core), so this is sth completely different.
That's why we'd like to have a working project as a starting point. I don't really care which MCU/devkit the example is for as long its ARM-cortex-M.

We need to do this bare-metal, because the KNX-stack does not work under a RTOS.

I have no preference for a TCP/IP-stack, but if wolf-MQTT runs with uIP or lwIP, most likely one of those.

We use IAR and GCC compilers.

Share

Re: looking for Cortex-M bare-metal example project

Hi Sebastian,

Building our libraries for bare-metal is the easy part. Both wolfSSL and wolfMQTT are pure C libraries designed for portability and even bare-metal use.

For building you have a few options:
1) Use ./configure and cross-compile the libraries for your target. Something like:

./configure --host=arm-none-eabi CC=gcc AR=ar --disable-shared --disable-examples --disable-crypttests --disable-asm --disable-rsa --disable-dh --enable-tls13 --disable-tlsv12 CFLAGS="-mcpu=cortex-m0 -mthumb" LDFLAGS="-mcpu=cortex-m0 -mthumb"

. The result is a .a static library. You can use --prefix= to specify a custom install path used with "make install". This generates a wolfssl/options.h with the build options used. You'll need to include this in your application

#include <wolfssl/options.h>

.

2) Use our example GCC Makefiles in IDE/GCC-ARM which can be easily setup for Cortex M0

3) Use your own IDE: Import the src/*.c and wolfcrypt/src/*.c files into your project and build directly. Add include to the wolfSSL/wolfMQTT root. Add pre-processor WOLFSSL_USER_SETTINGS and add your own user_settings.h file (examples here: https://github.com/wolfSSL/wolfssl/tree … s/configs)

You'll likely have to do some investigating on how to use LWIP on bare-metal. I don't know of an example we have for this. But google turned up this nice article: https://lwip.fandom.com/wiki/LwIP_with_ … ing_system

Perhaps a short technical call might help you get started?

Thanks,
David Garske, wolfSSL

Share

5

Re: looking for Cortex-M bare-metal example project

thanks for the pointers, we'll give this a try.
If we get stuck I'll come back to your offer to make a call.

Share