logs archiveBotHelp.net / Freenode / #43oh / 2015 / September / 10 / 2
Rickta59
and nothing has been setup
you get away with it on an avr
Spirilis
yeah I spent a lot of time back in april/may figuring out how to do a pre-ctor init in msp430-elf-gcc if you recall
Rickta59
but with arm .. you often have to turn on the clocks before you can modify any settings
Spirilis
yup
Rickta59
yeah .. pre-ctor init stuff ..
hmm ..
too bad the examples for arduino are like they are
it is already bitten them with the arm stuff
i see they tried to put a hack in .. instead of really addressing it
and telling people not to do it like that
Spirilis
what'd they do?
Rickta59
i forget the specifics
if you go look at the due startup.s
i think they try to jigger something before ctors are called
Spirilis
yeah that's what we do with energia tiva
startup_gcc.c runs an _init() before ctors
Rickta59
i remember looking at looking at it and thinking .. well that will fix some problems
but doesn't actually address the real problem
as you have no control of the order of how the ctors run
so if they have interdepencies it is going to break anyhow
Spirilis
basically 90% of the crap that was in energia lm4f main() is now in _init() and main() just runs setup followed by loop() in a while(1) and that serialeventrun thing
yup
Rickta59
anyways because you had been bit by this ..
your nrf24 stuff is done right
with a begin function
and a ctor that does nothing except save the pin numbers
and i was able to just plop that into the stm32duino stuff and it ijust worked by changing the pins
Spirilis
yeah
I learned early on how that sh*t is supposed to work
Rickta59
i wish arduino would shift a little to the right and be more c++ like
Spirilis
ok now with my ctors execution function in main(), time to see if this SPISettings stuff works right
hmmmmm
pausing it still showing up at 0x00000000
yep PC at 0x0
'ta fu*k is going on here...
oh I forgot to put __main() in my main
durr
since I closed out the cpp test projects I was doing and now on my main spi one
hm
now it's "main::i()" at 0x0
not sure what that means
guess it's time to single-step this bi**h
Rickta59
neat ...
just got the dhcp stuff configured properly for this tm4c1294
and nuttx
Spirilis
nice
Rickta59
now i can start doing something with it
what is a popular dns server that is at a fixed address aside from google's 8.8.8.8
* i do remember that one without having to look it up
Spirilis
208.180.24.4
ns.gkg.net (registrar I used for my domain)
Rickta59
i guess i should setup a local one
Spirilis
humm
now the next problem...
those ctors run from __main() don't seem to include the C++ vtable address loading stuff
the __GLOBAL_whatever thing that loads the vtable addresses into the head of the C++ object's struct
and yep test.map shows ctors is empty
ohhh look at that, now the vtable shows up in .gnu.linkonce.t.* and guess what.... the project's default ldscript doesn't even include .gnu.linkonce.t.*
put that in .rodata and now it's keeping it
still ctors is empty
Rickta59
yeah .. linker scripts can hose you
you are probably using one setup for c
Spirilis
no this was explicitly defined as a new C++ project
Rickta59
i always use the xxx-readelf thing to view all the generated sections from the compiler
you can see if there are any you aren't accounting for in your ldscript
xxx being msp430-elf, arm-none-eabi ..
Spirilis
hm
still nothing in ctors
the .o for test.cpp also shows some undefined's for ___ctors and ___ctors_end
not sure what that means
hummm
ok...
so it appears the vtable init stuff is called _GLOBAL__sub_I_SPI.1861.1351 or something
and the address for that function gets loaded into the __init_array stuff
e.g. included between __init_array_start and __init_array_end
that stuff does get executed from reset_program.asm iirc
it's like pre-ctors ctors lol
yep
is tm4c1294
10:04 < Rickta59> and nuttx
er
fu*k you synergy and your supposed copy & paste magic
here we go
RELOCATION RECORDS FOR [.text._GLOBAL__sub_I_SPI]:
OFFSET TYPE VALUE
00000002 R_RX_DIR32 .LANCHOR1
00000008 R_RX_DIR32 __ZTV10RSPI_RX210ILZ13SFRBASE_RSPI0EE+0x00000008
RELOCATION RECORDS FOR [.init_array]:
OFFSET TYPE VALUE
00000000 R_RX_DIR32 __GLOBAL__sub_I_SPI
__GLOBAL__sub_I_SPI gets tossed into .init_array
and from what I gather that does init the vtable entry information
i.e. puts it in the object's BSS struct memory
ah HAH.
with -Wl,--gc-sections enabled...
for some dumb reason .init_array gets clobbered "Discarded input sections"
I will note that for the RedHat newlib ldscript for RX, and probably most, the .init stuff has KEEP() around it
the e2studio GNURX linker has them as an .init and .fini section that follow .text basically so they go into ROM
let me try enabling KEEP for those 2 sections...
« prev 1 2 3 next »