avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] Is there interest in an arm-libc?


From: Bob Paddock
Subject: Re: [avr-libc-dev] Is there interest in an arm-libc?
Date: Mon, 10 Nov 2014 14:52:55 -0500

> One thing I couldn't find a reason for so far, is this insisting on user code 
> before main(), usually named SytemInit(). I think if there is any code before 
> main() It should be vector tables only, nothing which might change behavior.

The .initX and .finiX sections that run before/after main() are useful
as pseudo constructors/destructors.  Makes it so a file can be self
initializing, that is there is no need to put setup_this()
shutdown_that() type stuff in main().  Maintains separation of
concerns that way.

In radio.c:
void radio_init7( void ) __attribute__ ((naked)) __attribute__
((section(".init7")));
void radio_init7( void )
{
  Radio_InitializeUSART();  /* Set up the radio serial port hardware */
 }

void radio_fini7( void ) __attribute__ ((naked)) __attribute__
((section(".fini7")));
void radio_fini7( void )
{
 Radio_Shutdown();
}

Always need to keep 'naked' functions, and what they call simple.


The newlib nano that has been mentioned and custom linker scripts get
you along way in the ARM world.  I've been moving my AVR code to
Freescale KL25 ARM parts without much difficulty.

Here is atomic.h ported to ARM which you'll need:

https://github.com/PaulStoffregen/cores/blob/master/teensy3/util/atomic.h

 There are other things there that may help  you as well.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]