P2 catchup -
__red__
Posts: 470
Can someone help me understand the mechanism by which the P2 straps to TAQOZ or EEPROM?
For those that have not been following on for the entire time of the development the onramp is a little steep. I've read what I believe are the most recent docs but obviously, not having followed every thought process during the design like some I'm missing a few key pieces.
I figured the best way to better understand would be to start at first principles. Can anyone help me rough-out how the P2 straps itself?
First, the stats:
So - to my question:
When you power on the P2, is this an accurate representation of how it boots?
Questions:
For those that have not been following on for the entire time of the development the onramp is a little steep. I've read what I believe are the most recent docs but obviously, not having followed every thought process during the design like some I'm missing a few key pieces.
I figured the best way to better understand would be to start at first principles. Can anyone help me rough-out how the P2 straps itself?
First, the stats:
- Hub:
- 512KBYTES of Hub memory.
- A single 32bit CNT register.
- 16 Semaphores.
- 8 Cogs. Each cog has: 4kbytes of RAM separated into:
- 512 longs register RAM (2kbytes)
- a second SEPARATE 512 longs of lookup RAM which can be futzed with by its neighboring core (2kbytes).
- No SPIN 'terp in ROM.
So - to my question:
When you power on the P2, is this an accurate representation of how it boots?
- 16k Boot ROM is loaded into (0xFC000-0xFFFFF) (except really 0x7C000-0x80000)
- Does cog0 then set its PC to 0xFC000 and start execution from Hub RAM in place?
- (ROM_Booter.spin2?) (written in straight PASM2) does things with fuses, resistors etc etc... to work out where it's going to boot from. If it's TACOZ that you wish, then it's already a part of the ROM image in hub and executed there on cog0 from hub ram?.
Questions:
- Copies of the ROM appear to be embedded in the FPGA downloads - is it possible to get a copy of the ROM binary image to run through the emulator?
- Would that copy of the ROM just be a straight "Executable code from the first bit" or does it have checksums / preamble in front of it like the eeprom format? - I'm guessing the ROM image doesn't?
Comments
Now I find I don't understand any of it. I'm not sure if that is because it got over complicated along the way or because dementia has set in whilst I was waiting...
You could use pnut to build the binary obj file from rom_booter.spin2
Now I'm going through it by hand with spin2cpp/lexer.c's instr_p2[] to try and ascertain if that's what I've done correctly.
I used fastspin. Is there much of a difference in the output between the two?
No, fastspin 3.8.7 (and later) and pnut produce the exact same binary on rom_booter.spin2 (and should do so on any .spin2 files that are pure PASM2). You do have to remember to give the "-2" option to fastspin, of course, but you would have had a ton of errors if you tried to compile that file in P1 mode, so I'm sure you got that .
fastspin lets you produce a listing file if you give it the "-l" option. That can sometimes help with figuring out where things are in the boot rom.
That said, if you're using an emulator like spinsim you don't really need the boot ROM for anything. spinsim can run a P2 binary directly, as if it had been downloaded into the device with the boot ROM.
Thru combinations of pull-ups or pull-downs on the pins used for booting one should be able to disable some of the boot options, but I got lost somewhere at that point as of what is currently working.
Enjoy!
Mike
I'm confused by what appears to be two different "start" locations. The first has comments which talk about copying code within the FPGA and requiring a restart. The second starts with the initialization of the PRNG.
So I removed the first part and re-located the actual ROM image from 0xFC000 to 0x0 and recompiled only to be hit by "wrpin not implemented".
(The reason I'm picking on TAQOZ is because I'm looking for some application to play with and I don't really have a working C toolchain yet).
I am learning a TON though...
TAQOZ is fun and interactive, so it's certainly worth investigating. If you're comfortable compiling things, you mentioned that you have fastspin, so you have a Spin compiler for P2 as well if you want to play around with that. fastspin produces native code rather than Spin bytecodes, so it doesn't need the P2 Spin interpreter. (And as a bonus fastspin 3.9.x can compile BASIC as well as Spin, although the BASIC support is still a work in progress.)