00:15
bonda_000 has quit [Quit: Leaving]
03:50
jcea has quit [Ping timeout: 240 seconds]
04:22
Stromeko has quit [Ping timeout: 255 seconds]
04:28
Stromeko has joined ##raspberrypi-internals
08:04
bonda_000 has joined ##raspberrypi-internals
08:15
f_ has joined ##raspberrypi-internals
08:28
bonda_000 has quit [Ping timeout: 246 seconds]
08:31
bonda_000 has joined ##raspberrypi-internals
08:32
<
bonda_000 >
Happy Orthodox Easter to everyone celebrating
09:10
<
bonda_000 >
:clever using your linker script bootcode.ld to compile my own little bootcode program
09:18
<
bonda_000 >
bimbom@max:~/Desktop/armtimer/minix$ vc4-elf-ld -o prog sdram udelay -T bootcode.ld -lgcc
09:18
<
bonda_000 >
vc4-elf-ld: cannot find -lgcc
09:34
<
bonda_000 >
I guess it needs the vc4-toolchain/gcc-vc4/libgcc but doesn't know where to look for it
10:48
dolphinana has joined ##raspberrypi-internals
13:02
<
clever >
bonda_000: when you built gcc, it should have produced a libgcc.a
13:02
<
clever >
do `find / -name libgcc.a` to find it
13:03
<
clever >
you need to tell the linker where to look with a `-L/path/to/that/dir/`
13:04
<
clever >
that is better solved when you build binutils, you can set the default search path somehow
13:04
<
bonda_000 >
how di I distinguish between amd64 and the vc4 libgcc ?
13:04
<
bonda_000 >
it shows a crap ton of libgcc's
13:05
<
clever >
the vc4 gcc will be in whatever directory you installed the vc4 gcc to
13:05
<
clever >
lib/gcc/vc4-elf/6.2.1/libgcc.a
13:05
<
clever >
it will be a path like that
13:06
<
bonda_000 >
some are pointing to /nix/ dir
13:06
<
bonda_000 >
which we used to compile lk-overlay only right?
13:07
<
bonda_000 >
/nix/store/cwpy4q0qvdwdif1zfwnfg5gi50c6j9w8-vc4-elf-stage-final-gcc-debug-6.5.0/lib/gcc/vc4-elf/6.2.1/libgcc.a
13:07
<
bonda_000 >
/nix/store/v36hzrcnzprcxnrwsd3apkhy2j0if3n4-vc4-elf-stage-static-gcc-debug-6.5.0/lib/gcc/vc4-elf/6.2.1/libgcc.a
13:07
<
bonda_000 >
this looks ok: /home/bimbom/Desktop/vc4-toolchain/gcc-build/gcc/libgcc.a
13:08
<
bonda_000 >
actually here is the full list
13:08
<
clever >
yeah, if your using the copy you built yourself, then you want the one in Desktop/vc4-toolchain
13:09
<
clever >
/home/bimbom/Desktop/vc4-toolchain/prefix/lib/gcc/vc4-elf/6.2.1/libgcc.a
13:09
<
clever >
this is the one you want
13:09
<
clever >
2024-05-05 10:05:34 < clever> lib/gcc/vc4-elf/6.2.1/libgcc.a
13:09
<
clever >
2024-05-05 10:05:39 < clever> it will be a path like that
13:10
<
bonda_000 >
I haven't really installed vc4-elf toolchain I guess, since every time I open terminal I have to go to vc4-toolchain/ dir and type "export "PATH=$PWD/prefix/bin:$PATH"
13:10
<
clever >
you did install it, to /home/bimbom/Desktop/vc4-toolchain/prefix
13:10
<
bonda_000 >
well it always disappears from my PATH
13:11
<
clever >
because PATH is just an env variable
13:11
<
clever >
and its lost when you close that shell
13:11
<
clever >
either modify your .bashrc to add it to PATH automatically, or install it again to /usr/local
13:12
<
bonda_000 >
so I need to explicitly tell the linker path to libgcc
13:12
<
clever >
2024-05-05 10:04:02 < clever> that is better solved when you build binutils, you can set the default search path somehow
13:12
<
bonda_000 >
I thought I built all
13:12
<
bonda_000 >
follow the guideline
13:12
<
clever >
but you didnt configure it correctly
13:13
<
bonda_000 >
./build-all.sh 2>&1 | tee build.log
13:13
<
bonda_000 >
is how I built it
13:14
<
clever >
then that script didnt configure it correctly
13:14
<
bonda_000 >
did you build it differently?
13:14
<
clever >
i built it with nix
13:14
<
bonda_000 >
with what command
13:14
<
clever >
just run `nix-shell` in the `lk-overlay` directory
13:14
<
bonda_000 >
oh yep that's what I did
13:15
<
bonda_000 >
let's try again
13:15
<
bonda_000 >
I thought I had it
13:16
<
bonda_000 >
says sudo: nix-shell: command not found
13:16
<
clever >
dont run it with sudo
13:16
<
bonda_000 >
ok now it's hanging thinking
13:17
<
bonda_000 >
[nix-shell:~/Desktop/vc4-toolchain]$
13:18
<
clever >
now you can build things normally
13:18
<
bonda_000 >
like 'make' or use one of their scripts?
13:18
<
clever >
just normal vc4-elf-ld and vc4-elf-gcc will work there
13:18
<
bonda_000 >
or 'build'
13:19
<
clever >
`make PROJECT=vc4-stage1` if you want the stage1 bootlodader from LK
13:19
<
bonda_000 >
no I was trying to use the toolchain to build a simple binary
13:19
<
clever >
2024-05-05 10:18:54 < clever> just normal vc4-elf-ld and vc4-elf-gcc will work there
13:19
<
bonda_000 >
like enable uart, sdram, and test If I can write to C0000000 - FFFFFFFC
13:20
<
bonda_000 >
well they worked before also
13:20
<
bonda_000 >
I guess I didn't link properly
13:21
<
bonda_000 >
what's the benefit of using nix shell in this case?
13:21
<
clever >
it builds the binutils and gcc for you
13:21
<
bonda_000 >
as I write make Project vc4 stage1?
13:22
<
clever >
when you run `nix-shell`
13:22
<
bonda_000 >
it built vc4-binutils and vc4-gcc while it was starting up?
13:22
<
clever >
it was probably already built, given you had things in /nix/store/
13:23
<
clever >
so it just setup $PATH for you
13:23
<
bonda_000 >
oh yeah now my PATH looks way bigger
13:26
<
bonda_000 >
[nix-shell:~/Desktop/armtimer/minix]$ vc4-elf-ld -o prog udelay sdram -T bootcode.ld -lgcc
13:26
<
bonda_000 >
/nix/store/02j1692sjdp5pgzazqn98swgz115byds-vc4-elf-binutils-2.31.1/bin/vc4-elf-ld: cannot find -lgcc
13:27
<
bonda_000 >
why did you need GROUP(-lgcc) in your .ld anyway?
13:27
<
bonda_000 >
what's in that library that lk uses?
13:27
<
bonda_000 >
the .gnu.warning?
13:28
<
clever >
i dont remember what those do
13:28
<
clever >
arch/vpu/rules.mk:ARCH_LDFLAGS += -L/nix/store/cwpy4q0qvdwdif1zfwnfg5gi50c6j9w8-vc4-elf-stage-final-gcc-debug-6.5.0/lib/gcc/vc4-elf/6.2.1/
13:28
<
clever >
i also suspect my binutils isnt configured right either
13:28
<
clever >
i need that -L flag for it to work
13:33
<
bonda_000 >
well I'm currently filling up my Ghidra with peripheral structs
13:34
<
bonda_000 >
this already looks much better
13:35
<
bonda_000 >
I allocated volatile memory, then defined a struct with all regs and defined that memory as a struct. the clock manager stuff
13:36
<
bonda_000 >
hopefully I can import that to other .elfs that I have without issue
13:36
<
clever >
how did you import the struct?
13:37
<
bonda_000 >
I haven't I'm writing them manually like this
13:37
<
clever >
that could definitely save me some time
13:37
<
clever >
my problem is that i have to re-label every peripheral register, every time i import a new elf
13:38
<
bonda_000 >
I'm sure I saw the import button somewhere in the Data Type Manager just recently
13:38
<
bonda_000 >
commit data types to generic.clib?
13:39
<
bonda_000 >
that should be a shared one
13:39
<
clever >
where are you seeing that option?
13:41
<
clever >
oh, thats new
13:41
<
clever >
new to me at least
14:20
<
bonda_000 >
any idea what extraout_var is?
14:21
<
clever >
that tends to happen when ghidra doesnt get the return values right during decompile
14:21
<
clever >
look at the asm, which register is it?
14:21
<
bonda_000 >
in that same function 5b8 is declared then "if (CONCAT31(extraout_var,bVar2) != 0) {"
14:22
<
clever >
i dont see that
14:22
<
clever >
is it the first if, that decides between 52 and 37?
14:22
<
clever >
`beq r0, 0, ...5d6` ?
14:23
<
bonda_000 >
just something that came in in r0
14:23
<
bonda_000 >
although it thinks the function takes no arguments
14:23
<
clever >
the problem is that ghidra doesnt understand that the function call returns a uint
14:23
<
clever >
you need to edit the function it just called, and set a return type
14:23
<
bonda_000 >
undefined __stdcall FUN_600005b8(void)
14:24
<
clever >
not that function
14:24
<
bonda_000 >
which one?
14:24
<
clever >
the one that calls, down around line 10
14:24
<
clever >
it only calls a single function
14:24
<
bonda_000 >
bVar2 = FUN_60000470();?
14:25
<
clever >
this is what mind looks like
14:25
<
bonda_000 >
yeah that returned bool
14:25
<
clever >
it should be returning a uint
14:25
<
clever >
i see the problem now, bVar2 is a bool, but the compare is checking all 32 bits
14:25
<
clever >
so ghidra has to pull an extra 31 bits out of its hat, to make the compare happy
14:26
<
clever >
and that is what the extraout_var is, 31 bits that came out of nowhere
14:28
<
bonda_000 >
yeah right
14:28
<
bonda_000 >
it's not doing bittest its comparing with beq
14:29
<
clever >
which is a valid way to test for false and not false
14:30
<
bonda_000 >
and that FUN_60000470 took something from sram
14:31
<
bonda_000 >
since my bootrom is 64KB, 0x0 to 0x10000 I captured some of the sram
14:31
<
bonda_000 >
what I probably want to do is zero it out
14:31
<
bonda_000 >
and just make a sram struct
14:31
<
clever >
i dont think it needs to be a struct
14:31
<
bonda_000 >
like you did before with gp_area
14:31
<
clever >
or rather, yeah, for gp yes
14:32
<
clever >
then you can just hit find references, and find the code i just linked
14:33
<
bonda_000 >
does start_x.elf refer to that sram memory?
14:34
<
bonda_000 >
let me see
14:34
<
bonda_000 >
when I fixed gp at 60008000 there it showed me all the global variables
14:35
<
clever >
did you have to fix gp for every function?
14:35
<
bonda_000 >
yeah I've been doing it manually Set register value
14:35
<
clever >
ah, so same as my struct hack
14:35
<
bonda_000 >
but that elf has the defs for 60008000
14:35
<
clever >
does it show XREF's ?
14:36
<
clever >
as i expected, start_x.elf references the SRAM in 3 areas, otp, sdram, and aes/hdcp
14:36
<
bonda_000 >
*(unaff_gp+0xsomething) became isp_initialised = 1;
14:37
<
bonda_000 >
once I put a hard value for that entire function
14:37
<
clever >
sdram copies some code to sram, because you cant use dram when changing dram config
14:37
<
bonda_000 >
sorry my bad
14:37
<
bonda_000 >
**************************************************************
14:37
<
bonda_000 >
* FUNCTION *
14:37
<
bonda_000 >
**************************************************************
14:37
<
bonda_000 >
undefined __stdcall isp_init(void)
14:37
<
bonda_000 >
assume gp = 0xef07e00
14:37
<
bonda_000 >
undefined r0:1 <RETURN>
14:37
<
bonda_000 >
$t XREF[2]: Entry Point(*),
14:38
<
bonda_000 >
isp_init .debug_frame::0001d0a4(*)
14:38
<
bonda_000 >
0ed71d5c a3 03 stm r6-r9, lr,(--sp)
14:38
<
clever >
otp uses sram because keys are sensitive, and you could sniff the dram bus
14:38
<
clever >
and aes/hdcp, same reason
14:43
<
bonda_000 >
your struct hack wasn't showing global variables names
14:44
<
clever >
if you want to see them at 0x6000_8000, then you need to re-type that to the struct as well
14:48
<
bonda_000 >
it does some copying at cec00bbe
14:48
<
bonda_000 >
then does this
14:48
<
bonda_000 >
cec00be8 10 cc 01 00 mov p16,r1
14:49
<
bonda_000 >
thats a mutex
14:50
<
clever >
thats the suspend2ram code
14:50
<
clever >
its saving some things to sram, so it can turn the dram controller off
14:51
<
bonda_000 >
do I declare sram 60008000 of length C000 as volatile, non-initialized?
14:52
<
clever >
not volatile, i prefer initialized to 0
14:59
<
bonda_000 >
I have 20+ xrefs to SRAM
14:59
<
bonda_000 >
in the unstripped start_x.elf
14:59
<
clever >
2024-05-05 11:36:37 < clever> as i expected, start_x.elf references the SRAM in 3 areas, otp, sdram, and aes/hdcp
16:10
Stromeko has quit [Ping timeout: 272 seconds]
16:14
Stromeko has joined ##raspberrypi-internals
16:38
bonda_000 has quit [Ping timeout: 256 seconds]
16:52
f_ has quit [Ping timeout: 260 seconds]
17:27
dolphinana has quit [Quit: Leaving]
17:30
bonda_000 has joined ##raspberrypi-internals
17:33
dolphinana has joined ##raspberrypi-internals
18:05
<
bonda_000 >
do you know what's going on in the usb.h?
18:05
<
bonda_000 >
:clever
18:06
<
bonda_000 >
many registers redefined
18:07
<
clever >
for example?
18:07
<
bonda_000 >
#define USB_DPTXFSIZ1 HW_REGISTER_RW(0x7e980108)
18:08
<
bonda_000 >
#define USB_DIEPTXF2 HW_REGISTER_RW(0x7e980108)
18:08
<
bonda_000 >
in the same header
18:09
<
clever >
just 2 different names for the same register
18:10
<
clever >
Device IN Endpoint Transmit Fifo Size Register: (DIEPTXFn)
18:10
<
clever >
Offset: 104h + (FIFO_number – 1) * 04h
18:10
<
clever >
that register only matters when the dwc2 controller is acting as a usb device
19:12
bonda_000 has quit [Ping timeout: 256 seconds]
19:26
bonda_000 has joined ##raspberrypi-internals
21:54
bonda_000 has quit [Quit: Leaving]
23:47
dolphinana has quit [Quit: Leaving]