Re: Wrong assembly code generated from C code (ARM Cortex-m3) ?

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

 



On 02/12/2021 17:06, Sébastien Gendre wrote:
> Hello David,
> 
> Thanks for your reply.
> 
> Writing a firmware from scatch and not using the official IDE is the
> challenge.
> 
> It's based on this video of Nikolay Kondrashov who do the same thing for
> another microcontroller with the same arch:
> https://media.ccc.de/v/ASG2019-161-microcontroller-firmware-from-scratch
> 
> I started by reading the arch and microcontroller manuals to see how its
> start, how the memory are mapped, which clock and peripherals are
> enabled after a reset, etc.
> 


OK - but again, this is not the list for such things, as you are not
facing gcc issues.

I had a look at some of that video (not all of it as yet).  I can agree
that it can be fun and educational to do things from scratch, and see
how things fit together at the lowest level.  But I don't think you
should start there.  And it is wrong to suggest that this is all somehow
necessary in order to use open source tools - when you use
vendor-supplied tools these days, the solid majority of the parts are
open source.  They are simply put together by the vendor.

Also note that if you are trying to run code directly from the reset
vector, you don't have a full C environment.  Your static data is not
initialised or zeroed.  Functions such as "printf" are unlikely to work.
 If you are using C++, static constructors or initialisers that require
functions are not run.  The reset vector is useful for things that need
to be initialised before this - perhaps enabling clocks, memories, etc.
 It is not appropriate for "real" code.






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux