This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48L950 GCC Newlib

Other Parts Discussed in Thread: RM48L950, HALCOGEN

Hello,

I have used Halcogen to successfully generate HAL drivers for the RM48L950 MCU (using the GNU tools option) and have successfully compiled and run some basic examples (SCI, etc.) However, I am now attempting to use dynamic memory and am modifying a "newlib_stubs.c" file I've created (this is a common practice to define stub functions for things like _sbrk()). I need to write a bit of code that accesses and returns the main stack pointer (MSP) using something like http://pastebin.com/0F62Mrb6 but can't seem to get it to work (I keep getting printouts of stack and heap collision over STDERR whenever I attempt to do anything involving dynamic memory allocation at runtime.)

Any ideas?

EDIT: Link to my code and build workspace so far: https://github.com/Aghosh993/HerculesWorkspace

  • Abhimanyu Ghosh2 said:
    I keep getting printouts of stack and heap collision over STDERR whenever I attempt to do anything involving dynamic memory allocation at runtime

    While not for a Hercules device, the thread CCS GNU C Compiler and Linker Setup explains how the stack and heap were set up to allow dynamic memory allocation to be used for a Cortex-M4F device with the GCC compiler and Newlib.

    I found there was a _sbrk function inside the pre-compiled libraries when the GCC ARM compiler was installed from CCS and that didn't have to create any stub functions - just had to set up the stack and heap in the linker script to meet the requirements of the GCC Newlib.

  • Hi,

    Thanks for the reply. I am not really using CCS (I have a workspace set up using a Makefile and arm-none-eabi-gcc), and would highly prefer to define my own newlib stubs as that allows for configurability of things like output methods (at build-time I can define which UART to use for STDOUT and STDERR for example.) I'll post up my build workspace on Github and add a link shortly to my post. Maybe that'll shed better light on what I might be doing wrong.

    Thanks,

    - A.G.