Library 58- Dynamic strings on STM32F4xx

Have you ever been in position where you need to store some string informations just for a small amount of time? Did you reserve ram memory before you worked with strings?

If you did it like that, than this library might be a solution for you.

This library was designed directly for a purpose where you need to store your information for a few time. For example, getting some string informations from your sensor, USART, etc.

It uses malloc and free functions to allocate a memory inside HEAP section of RAM. So, if you have in plain to use a biiig array of strings, first make sure that your HEAP section is big enough where malloc and free functions can operate.

Library

Features

  • Dynamic string operation
  • Allocation size depends on string size only, no preallocations
  • Allows for dynamically search for new sections of memory if current preallocated memory is full
  • String deletion allowed one by one or all at a time

Dependencies

  • CMSIS
    • STM32F4xx
  • TM
    • defines.h
  • C
    • string.h
    • stdlib.h

As I said above, library uses HEAP memory. If you use Keil uVision and startup files provided from ST or if you downloaded it from my Github or default Keil uVision project, then HEAP memory is by default set to 0x200 Bytes = 512kB which can be quite small for something like strings can be in size.

So, in case of Keil uVision, you can open .s (startup file) inside your project and edit variable “Heap_Size” to a value you want to reserve for HEAP.

Functions and enumerations

Example

Project is available on my Github account, download library below.

Icon
TM STM32F4xx STRING Library

tilz0R

Owner of this site. Also electronic enthusiasts, web developer, 3D printer fan, handball player and more. Big fan of STM32F4 devices. In anticipation of the new Discovery board for STM32F7 lines.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!