blm768
Posts: 24
Joined: Sun Nov 18, 2012 6:13 am

ATAGS

Tue Jan 08, 2013 3:44 pm

I've been writing some code to process the ATAGS so I can get a memory map, but I'm having some difficulty actually getting useful values. It appears that the ATAG_CORE is there as expected, but its page size field is set to zero, and it's immediately followed by an ATAG_END.

Am I just missing an option in config.txt, perhaps?


BrianW
Posts: 83
Joined: Sun Jul 29, 2012 9:03 pm

Re: ATAGS

Wed Jan 09, 2013 12:40 am

blm768 wrote:I've been writing some code to process the ATAGS so I can get a memory map, but I'm having some difficulty actually getting useful values. It appears that the ATAG_CORE is there as expected, but its page size field is set to zero, and it's immediately followed by an ATAG_END.
When I tried this (https://github.com/brianwiddas/pi-barem ... er/atags.c), I found I was getting ATAG_CORE, ATAG_MEM, ATAG_INITRD2 (if an initial ramdisk was configured), ATAG_CMDLINE and ATAG_NONE.

ATAG_CORE had the three optional values (flags, page size and root device), but they were all zero.

The first handful of byes of the ATAGs data is:

0x00000005 - length of ATAG_CORE
0x54410001 - ATAG_CORE
0x00000000 - flags
0x00000000 - page size
0x00000000 - root device
0x00000004 - length of ATAG_MEM
0x54410002 - ATAG_MEM
0x0c000000 - size of memory area (in this case, 192MB)
0x00000000 - address of memory area (0x00000000 - 0x0bffffff)
[etc]

Since the value of ATAG_NONE is zero, is it possible you didn't increment far enough into the memory, and misread one of the ATAG_CORE values as ATAG_NONE?

Alternatively, did you go too far and read the start address of ATAG_MEM as ATAG_NONE? If you counted 5 words from the start of the data in ATAG_CORE rather than the start of the header, this would happen.

blm768
Posts: 24
Joined: Sun Nov 18, 2012 6:13 am

Re: ATAGS

Wed Jan 09, 2013 4:50 am

I think I've got it figured out; the length field is in words, not in bytes. I'll test it out when I get a chance.

Return to “Bare metal, Assembly language”