Skip to main content
Blog

Zephyr Weekly Update – HTTP Server FTW! 🥳

Happy Friday, and welcome back for a new Zephyr Weekly Update! Before diving into some of the additions and notable updates from this week, I wanted to mention that the recordings of all the presentations from the Zephyr Developer Summit 2024 are now available on the YouTube channel of the Zephyr Project.

There were some truly great sessions (and speakers!) and there is a very good chance that you will want to catch up and watch all of them if you didn’t have a chance to attend in person! 😀

HTTP Server

This week’s big update is the addition of a long awaited HTTP server library. It supports HTTP/1.1 as well as HTTP/2, with or without TLS, and WebSocket support should be coming shortly! This has been a multi-month effort that started last year as a Google Summer of Code project from Emna Rekik.

Similar to the socket and CoAP services, adding new HTTP resources can easily be done, with very little overhead, not so differently from how you would do it in a higher-level language like Python or JavaScript!

struct http_resource_detail_static index_html_gz_resource_detail = {
	.common = {
			.type = HTTP_RESOURCE_TYPE_STATIC,
			.bitmask_of_supported_http_methods = BIT(HTTP_GET),
			.content_encoding = "gzip",
		},
	.static_data = index_html_gz,
	.static_data_len = sizeof(index_html_gz),
};

HTTP_RESOURCE_DEFINE(index_html_gz_resource, test_http_service, "/",
		     &index_html_gz_resource_detail);

I highly recommend you dive into the new code sample that will tell you a lot more about the various capabilities of this new service, including how to configure it, or even to profile it.

Power Management for dummies using the Zephyr shell

You’ve heard me praise the Zephyr shell many times before. It is an awesome resource to quickly troubleshoot your system and interact with all your peripherals and subsystems without having to write any code.

A new pm shell module has been introduced to let you interact with the power management subsystem using simple commands. Assuming that power management is indeed enabled in your Zephyr application, you can now do things like pm suspend mydevice to quickly suspend a device.

What’s more, device list, which might be one of the most useful commands in the Zephyr now also gives you feedback regarding the actual PM mode of all the devices in your system:

uart:~$ device list
devices:
- i2c@40003000 (active)
- buttons (active, usage=1)
- leds (READY)

In this example, leds is a device that does not support PM, i2c supports PM with manual suspend and resume actions and is currently active, and buttons supports runtime PM, is currently active and “used” by one user.

As part of introducing all these great commands, Fabio has also added a new callback that a shell module might implement to make tab-completion for device names smarter. In the context of the new pm shell command mentioned before, it means that only devices that do support power management will be suggested when you hit TAB!

Please check out PR #72037 and update your shell modules accordingly 🙂

Boards & SoCs

  • Added MMC driver for RCAR. (PR #60285)
  • Added TPM counter support on i.MX93 Cortex-A Core. (PR #70714)
  • Added RTC driver for Nuvoton Numaker m46x. (PR #71929)
  • Added ADC driver for Nuvoton numaker m2l31x. (PR#71267)
  • Added SDHC driver for ESP32. (PR #71165)

New boards:

  • MikroElektronika Weather Click shield, which features Bosch BME280 sensor (humidity, pressure, temperature). (PR #71076)
  • STM32C0116 DK, a development board for the STM32C0 series of MCUs — Cortex-M0+ with 32K of Flash, 6K of RAM, a Grove connector, a 5-way joystick, … (PR #71722)

Drivers

  • Texas Instruments TMP114 is an ultra-thin, high accuracy, I2C temperature sensor with a 16-bit ADC and an accuracy of ±0.2°C. (PR #71964)

Miscellaneous

  • Added support for LoRaWAN Fragmented Data Block Transport Service. Being able to transmit fragmented blocks of data over an otherwise very constrained network in terms of MTU means essentially unlocking the ability to perform firmware upgrades over-the-air. (PR #68570)
  • New ability for west to run some commands (e.g. erase, recover) only once, either at the beginning or at the end of the programming of a board when using sysbuild. This allows to e.g. only erase the flash once when targeting a multi-core SoC. More documentation available here. (PR #69748)
  • Added support for EUI64 device identifiers in hwinfo. (PR#72057)
  • New code samples for the I2C Target API. (PR #72103)
  • New settings_save_subtree() API allows to only save items from a settings subtree that are different from their persisted value. (PR #72113)

A big thank you to the 9 individuals who had their first pull request accepted this week, 💙 🙌: @swift-tk, @DeHess, @dalprahcd, @0x6e, @fgihl, @bogdanm, @tychofrei02, @JefersonFernando, and @kail.

As always, I very much welcome your thoughts and feedback in the comments below!

Benjamin Cabé

Benjamin is a technology enthusiast with a passion for empowering developers to build innovative solutions. He currently serves as the lead developer advocate for the Zephyr Project. You can find him online as @kartben on virtually every social platform, and you can check out his blog at blog.benjamin-cabe.com.