ndufresne has quit [Remote host closed the connection]
lunixoid has joined #linux-sunxi
apritzel has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
tnovotny has joined #linux-sunxi
apritzel has joined #linux-sunxi
chewitt has quit [Ping timeout: 480 seconds]
vpeter has quit [Remote host closed the connection]
vpeter has joined #linux-sunxi
Mangy_Dog has joined #linux-sunxi
ndufresne has joined #linux-sunxi
Danct12 has joined #linux-sunxi
JohnDoe_71Rus has joined #linux-sunxi
tnovotny has quit [Quit: Leaving]
cmeerw has joined #linux-sunxi
ndufresne1 has joined #linux-sunxi
ndufresne has quit [Quit: Page closed]
ndufresne1 is now known as ndufresne
vagrantc has joined #linux-sunxi
lunixoid has quit []
apritzel has quit [Ping timeout: 480 seconds]
apritzel has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
indy has quit []
indy has joined #linux-sunxi
hlauer has joined #linux-sunxi
apritzel has joined #linux-sunxi
dok has joined #linux-sunxi
dok has left #linux-sunxi [#linux-sunxi]
jmas has joined #linux-sunxi
<jmas>
hi (registered this time)
<jmas>
I am trying to hack on A64 SoC but I really suck at it.
<jmas>
I am trying to blink a led on a pinephone with bare aarch32 assembly. I've tried my best to remake a very simple eGON image "generator".
<jmas>
but somehow sunxi-fel gives me this message: usb_bulk_send() ERROR -7: Operation timed out
<jmas>
any tips and tricks ;) ?
warpme_ has joined #linux-sunxi
JohnDoe_71Rus has quit []
ftg has joined #linux-sunxi
plaes_ has joined #linux-sunxi
plaes has quit [Ping timeout: 480 seconds]
<jmas>
after using `sunxi-fel write 0x10000 <file>` and `sunxi-fel exe 0x10000` then I cannot do any other commands with `sunxi-fel`, I can't understand why.
Esmil has quit [Ping timeout: 480 seconds]
<jmas>
the code I am trying to execute is a simple loop with `1: wfi` `b 1b`
Esmil has joined #linux-sunxi
warpme_ has quit [resistance.oftc.net weber.oftc.net]
cphealy has quit [resistance.oftc.net weber.oftc.net]
buZz has quit [resistance.oftc.net weber.oftc.net]
sauce has quit [resistance.oftc.net weber.oftc.net]
vagrantc has quit [resistance.oftc.net weber.oftc.net]
lvrp16 has quit [resistance.oftc.net weber.oftc.net]
clever has quit [resistance.oftc.net weber.oftc.net]
narmstrong has quit [resistance.oftc.net weber.oftc.net]
sauce has joined #linux-sunxi
clever has joined #linux-sunxi
warpme_ has joined #linux-sunxi
vagrantc has joined #linux-sunxi
narmstrong has joined #linux-sunxi
lvrp16 has joined #linux-sunxi
cphealy has joined #linux-sunxi
buZz has joined #linux-sunxi
hlauer has quit [Ping timeout: 480 seconds]
<apritzel>
jmas: because FEL is code in ROM, running on the Cortex core you have just blocked?
<jmas>
hum, I see
<apritzel>
for sunxi-fel to succeed and then continue with FEL you need to "ret" at the end
<jmas>
and how does u-boot doesn't freeze the FEL, it must do some kind of reset if nothing bootable is found or something like this
<apritzel>
When U-Boot (proper) starts, FEL is gone
<apritzel>
for the SPL is does its job, then returns to FEL
<apritzel>
which is actually not trivial if you did more than a few instructions meanwhile
<jmas>
uh, I wasn't expecting this. Why does U-Boot SPL returns to FEL ?
<apritzel>
because it relies on FEL to load more code
<apritzel>
the main purpose of the SPL is to enable DRAM
<jmas>
is this related to boot0/boot1 ?
<apritzel>
you cannot load into DRAM initially, because it's not working right after boot
<apritzel>
boot0 is similar to U-Boot's SPL, yes
<apritzel>
boot1 is only used on older SoCs, I gracefully forgot about its exact purpose
<jmas>
OK that DRAM is not initialized.
<apritzel>
so the SPL starts, sets up some clocks, initialises the DRAM, then returns to FEL, carefully restoring most of the state for that to work
<apritzel>
that's the 32-bit code, but it's easier to understand
<jmas>
okay. So FEL see the eGON.BT0 header and start u-boot SPL right ? then SPL return to FEL.
<jmas>
and then FEL looks for the eGON.BT1 ? or that's something else ?
<apritzel>
the FEL USB protocol and the BROM routines implementing it don't really care about eGON headers, its routines allow to download, upload and execute
<jmas>
uh yeah, right FEL != BROM
<apritzel>
the sunxi-fel tool requires eGON headers, but this is a rather artificial molly guard, to make sure you are loading the right code
<jmas>
so does this means that the eGON header can be valid only to the sunxi-fel tool ? and not to the BROM ?
<apritzel>
when using FEL: yes
<apritzel>
you can actually patch the check in sunxi-fel away, then don't need an eGON header
<jmas>
okay, good to know.
<apritzel>
but when the BROM loads from MMC, NAND, SPI, you need an eGON header
<jmas>
right
<apritzel>
jmas: you can try to setup the GPIO controller using multiple "sunxi-fel writel" commands
<apritzel>
jmas: to blink your LED manually
<jmas>
uh, yeah good idea,
<apritzel>
when you know this works, you write that as aarch32 assembly, add the eGON header, end with a "ret" and then use "sunxi-fel spl", to upload, execute and return
<apritzel>
once that works, you have a foot in the door and can work your way up from there
<apritzel>
but keep in mind that it's only SRAM at this point, and you need to leave something for the FEL stack
<apritzel>
(sunxi-fel moves the FEL data out of the way for you, but you must not touch that copy)
<apritzel>
but the first 32KB are all yours
<jmas>
ok thanks
<jmas>
ok I managed to turn a led on through sunxi-fel writel
<jmas>
and I've rewrite the asm to as close a possible to the commands
<jmas>
and it worked \o/
<jmas>
either I am stupid and cannot write proper arm assembly or I don't know... I don't see where I fucked up...
<jmas>
maybe doing a read / update / write is not the same as writing the value directly
<jmas>
fukc, I wasn't setting the right gpio
<jmas>
Thanks for your help apritzel !
<apritzel>
yeah, doing those low level experiments can be tedious, just one wrong bit and nothing happens
cmeerw has quit [Ping timeout: 480 seconds]
<jmas>
yeah, it's even wrost without a proper debugging interface, but at least now I have an LED... :)
<jmas>
i am going to stop on this success for tonight