Size and speed optimisations

@andysworkshop andysworkshop released this Nov 12, 2016 · 7 commits to master since this release

This release collects together a number of optimisations for speed and size. You can read about them in more detail in issue #189. To summarise, they are:

  1. Wrap the libc atexit function with a do-nothing replacement. This is one of those methods that's only required if you have a real OS managing your process.

  2. Add a scons option for link-time optimisation (lto=yes). Link-time optimisation can save a lot of space due to the ability to optimise across compilation units. This even benefits those of us that practice 'header-only' development due to its ability to optimise the inefficient layout of the ST standard peripheral library.

  3. Import the small, efficient implementation of the udiv instruction from the chromium project. The F0 does not have a udiv instruction so it has to be done in software and the gcc implementation isn't small or efficient. Other MCU families are not affected.


Release 4.0.4

@andysworkshop andysworkshop released this Jul 10, 2016 · 28 commits to master since this release

Merge branch 'master' of


4.0.3: Miscellaneous enhancements and fixes

@andysworkshop andysworkshop released this Oct 31, 2015 · 128 commits to master since this release

Release 4.0.3 collects together a number of new features and bug fixes. Notably:

#126 Remap I2C1 on STM32F1
#134 STM32F10X MD support
#129 Support HSI internal clock when available on the MCU
#128 Implement support for the internal flash peripheral
#124 Upgrade to v1.5 of the standard peripheral library for the F0.
#116 Provide async version of tcpConnect().


Release 4.0.2: bug fixes

@andysworkshop andysworkshop released this May 3, 2015 · 193 commits to master since this release

This release collects together the bug fixes that have been applied since release 4.0.0. The following issues have been addressed:

#97: Fix floatOpt function so that it actually works
#100: stm32f4xx_can doesn't build correctly
#103: SPI Timing issue
#105: Fix cmake example
#106: Update 'new' signature
#108: Ethernet PHY Support (for the LAN8710A)
#112: Switch htons -> ntohs in UDP example
#113: Support for the Tianma TM032LDH05


Release 4.0.0 - F4 USB device support

@andysworkshop andysworkshop released this Feb 21, 2015 · 214 commits to master since this release

Release 4.0.0 marks a major milestone in the development of stm32plus because we now support the USB peripheral in device mode on the F4 series of MCUs. Device mode means that your F4 operates as a peripheral device when connected to a host such as a PC.

  • The onboard full speed PHY (12Mb/s) is the only supported PHY. The external ULPI PHY (480Mb/s) is not yet supported.
  • The supported device classes are HID, CDC and MSC.

There are a number of new examples that demonstrate the use of the USB peripheral. They're all designed to run out-of-the-box on the popular F4 discovery board so you should be able to get up and running really quickly.

usb_device_cdc_com_port creates a virtual COM port that allows you to talk to your discovery board down the USB cable just as if it were an old style serial port. If you were thinking of using one of those FTDI USB-to-serial converters in your project then this technique just saved you a few dollars.

usb_device_hid_custom_adc shows how to create a HID device that periodically sends back small packets of data to the host. In this example we use the ADC peripheral to do conversions and send back the results to the PC. Real-world examples might be environment monitoring, for example temperature or weather.

usb_device_hid_keyboard shows how to configure a HID device as a keyboard. Our example illustrates how to send back keystrokes to the host as well as to receive LED indicator change updates from the host.

usb_device_hid_mouse creates a wacky mouse out of your F4 discovery board. The built-in accelerometer is used to move the cursor around the screen.

usb_device_msc_internal is a mass-storage device example. A small FAT12 filesystem is compiled into the hex file that you flash to the F4. When you connect up the F4 to the PC the filesystem is mounted and you can open and view a few sample files.

usb_device_msc_sdcard is the canonical mass storage example and demo's the killer feature of the mass storage device class, that is the ability to hook up an SD card and use it as a disk drive storage device. This is not a standalone example - you'll need to hook up an SD card to your F4 to use it.

In addition to this major new feature there are a number of small features and bug-fixes.

Added the SemiHosting class and example: #80
Semi-hosting is a bad name for a great feature. It allows you to output debug strings from your running firmware to the console of the attached debugger. That means that if you're debugging in Eclipse and are using OpenOCD to connect to your board then you'll see strings output in your OpenOCD terminal window. There's an example to show you how to use it. Thanks to @joac for contributing this code.

Spi: add single byte/half-word send: #88
This new feature allows you to easily send single bytes to the SPI peripheral. Thanks to @punkkeks for this contribution.

Fix FMC #89
This is a small bug fix that fixes usage of the FMC peripheral on the F429 series.


Release 3.6.0: F030 support

@andysworkshop andysworkshop released this Jan 2, 2015 · 345 commits to master since this release

I'm happy to announce the 3.6.0 release of stm32plus featuring support for the low-cost F030 Cortex-m0 line (big thanks to @joaoc for contributing this feature). This will probably be the last 3-point-something release before the major 4.0.0 release that will support the most popular USB device classes on the F4. More on that later, but now let's see what we've got in 3.6.0:

Typo fix and addition of STM32F030: #78
The headline feature for this release. The scons mcu target name is f030, for example: scons mode=small mcu=f030 hse=8000000.

Upgrade f4 std peripheral lib to 1.4.0 and support all F4 variants: #64
Adds explicit support for many more F4 variants via the scons build. In practice I expect most people to carry on using mcu=f4 which is now an alias for mcu=f407.

EXTI line 13 interrupt problem: #79
Fix a problem affecting port C EXTI interrupt support on the f0 and f4 whereby the SYSCFG clock was not enabled.

SDIO driver does not support 16Gb+ card capacities: #77
ST demonstrate that they don't really understand how the C language works :(

Cannot remap USART1,2,and 3 on STM32F1 series: #74
Important fix for USART users on the F1 series.

Found a mistake in include/traits/f1/cl/traits.h: #71
Removed some unused code.

F4 OTG FS Wakeup IRQ handler name incorrect: #70
We'll need this fix for the next release.

Exti IRQ handler gets garbage collected by the linker: #69
gcc gets a bit over-zealous with its garbage collection algorithm.

Expose remote address of received UDP datagrams: #68
Add commonly required functionality to the network stack.

net_udp_receive_async doesn't clear data arrived flag on startup: #67
Bug in one of the examples.


Release 3.5.0

@andysworkshop andysworkshop released this Oct 22, 2014 · 378 commits to master since this release

Release 3.5.0 consists of one very important change and a collection of minor fixes.

SysTick interrupt handler is now a weak symbol

In order to solve issue #18 SysTick_Handler is now a weak symbol. The advantage of doing this is that you can supply an implementation of SysTick_Handler yourself and it will be used in preference to the one supplied by stm32plus. This is a requirement for integration with RTOS systems that need SysTick for their own use.

To complete the feature I have removed the previous weak SysTick_Handler from every example startup.asm because multiple weak symbols of the same name results in undefined behavious. See commit 08aef0f for details.

Action required!

If you have a program that is built against release 3.4.0 and you have used a startup.asm derived from an stm32plus example then you must delete the weak reference to SysTick_Handler from your startup.asm. See any one of the examples for details (I've commented out the weak reference).

Fixes and features.

  • SDIO multi-block read/write implemented. (#59)
  • Add slave 2nd address support to I2C
  • Enable internal pullups on the SDIO lines so externals are not required.
  • I2C peripheral 2 support on the F0.
  • Enhance circular_buffer so it's safe for the IRQ writer, main thread reader common scenario.
  • Move fonts to flash on the F0. #60.
  • Fix I2C interrupt flag names on F0.
  • Optimise speed of signal/slot implementation (e.g. interrupts) for the common case of a single subscriber. Results in a 2x speed increase.
  • RMII remap pinout on F4 was incorrect. Fixed.
  • net physical layer gets a PhyHardReset feature class.


Release 3.4.0: minor fixes and new features

@andysworkshop andysworkshop released this Aug 10, 2014 · 418 commits to master since this release

Release 3.4.0 contains some minor fixes accrued since the previous release and a few new features.

Timer channel feature templates

The features used by a timer channel can now be declared as a list of feature types within the channel template. This is a breaking change, however the changes required by you are very minor indeed. You used to declare a timer channel like TimerChannel2Feature. In this version you must declare it as TimerChannel2Feature<>. No further changes are required but I encourage you to make use of the feature types.

Here's an example of using the new declarative features taken from the timer_input_capture example:

    TimerChannel3Feature<               // we're going to use channel 3
      TimerChannelICRisingEdgeFeature,  // rising edge trigger
      TimerChannelICDirectTiFeature,    // direct connection
      TimerChannelICPreScaler1Feature,  // prescaler of 1
      TimerChannelICFilterFeature<0>    // no filter

This declarative method deprecates the initCapture and initCompare timer channel methods.

cmake support

Thanks to Mike Purvis stm32plus now supports the cmake build system. Check out the code here if you'd like to use this build system in preference to the default scons.

GNU Tools for ARM Embedded Processors now the preferred toolchain

After spending several months using this toolchain and having performed a thorough regression test against the darkest corners of the library I am now making the GNU Tools for ARM Embedded Processors the default toolchain in preference to Sourcery g++ Lite. The killer feature and the reason for this change is that the GNU Tools toolchain supports the hardware FPU in the F4 and Sourcery g++ Lite does not.

Bug fixes

Click here for a full list of issues closed in this release.


Release 3.3.0: ADC support & bug fixes

@andysworkshop andysworkshop released this Jun 14, 2014 · 467 commits to master since this release

ADC Support

Release 3.3.0 of stm32plus adds support for the ADC peripheral on all MCUs. Seven new example programs show you how to use the various features of this very flexible STM32 peripheral.

  • adc_single. A good demo for getting your feet wet in the world of the ADC. Shows how to convert data on a single channel whilst polling for the results.

  • adc_single_interrupts. Polling for data is an inefficient use of your CPU cycles. The ADC can raise interrupts to tell you when a conversion has finished. This example does just that.

  • adc_single_dma_multichan. A step up from the adc_single example, here we add more channels to the mix and use DMA to transfer the data in the background. We also use the built-in temperature sensor channel to read the chip's temperature.

  • adc_analog_watchdog. Use the ADC to guard an input from going outside an acceptable range. Raises an interrupt when the range is violated.

  • adc_multi_dma_multichan. The F1 and F4 both support multiple ADC peripherals. This example shows how to run two of them simultaneously in master/slave mode using DMA to move data from the peripheral to memory.

  • adc_single_injected. The F1 and F4 support the concept of injected channels that can be automatically converted in conjunction with the regular channels. This example shows how.

  • adc_single_timer_interrupts . Using software to start a conversion is just one of the myriad ways to trigger the ADC on the STM32. This example illustrates one of the alternative methods by using a timer to trigger the ADC at periodic intervals.

Other features and fixes

The full list of issues fixed in 3.3.0 is available here.