Startup files for STM32F4xx

Jens Bauer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 25 10:26:06 PDT 2015


On Saturday, 25 April 2015 at 11:50:19 UTC, Martin Nowak wrote:
> On Saturday, 25 April 2015 at 07:31:45 UTC, Jens Bauer wrote:
> Static constructors are possible if you strip down ModuleInfo 
> (requires compiler hacking).
> You should care about that stuff last. It's way more important 
> to make things work without dynamic memory allocation first.

I agree and thanks for reminding me; I don't want to lose my 
focus. ;)

>> That means 'new' and 'delete' / 'malloc' and 'free' must be 
>> able to handle multiple RAM locations (because there's also 
>> external SRAM and external SDRAM).
>
> IIRC then the C/C++ malloc would simply can your sbrk

Heh, I didn't know about sbrk before I almost finished writing 
mine.
This resulted in that mine can be used side-by-side with the 
standard malloc.
(I named mine m_malloc and m_free).

> implementation, so it only supports a single heap, which should 
> be the external if available.

In C++, it's possible to override new and delete on a per-class 
basis, I'd expect that this is possible in D as well, is this 
correct ?
-If it is, then I think there's no problem, because then the 
class can handle special cases, when it knows it's working with 
the DMA.

Allocation could default to SDRAM if SDRAM exists; then external 
SRAM, then CCMRAM and finally fallback to Local on-chip SRAM.
(Note: any external RAM needs to be initialized by the 
microcontroller's firmware, before the external RAM can be used, 
I do not know if that could be a problem with the 
linker-generated static constructors).


More information about the Digitalmars-d-learn mailing list