Shop OBEX P1 Docs P2 Docs Learn Events
P2 catchup - — Parallax Forums

P2 catchup -

__red____red__ Posts: 470
edited 2018-10-10 20:07 in Propeller 2
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:
  • 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

  • Heater.Heater. Posts: 21,230
    I have been "following on for the entire time of the development the onramp".

    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...



  • evanhevanh Posts: 15,915
    There is a lot in the prop2. I think even Chip is at his limit for holding enough in his head to make changes.

  • evanhevanh Posts: 15,915
    Red,
    You could use pnut to build the binary obj file from rom_booter.spin2
  • I *think* I just successfully compiled the ROM code to binary format.
    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 if it makes much of a difference?
    evanh wrote: »
    Red,
    You could use pnut to build the binary obj file from rom_booter.spin2

    I used fastspin. Is there much of a difference in the output between the two?
  • __red__ wrote: »
    I used fastspin if it makes much of a difference?
    evanh wrote: »
    Red,
    You could use pnut to build the binary obj file from rom_booter.spin2

    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.
  • As for the boot options, there is currently some glitch in it, but basically the P2 can boot from serial, from flash and from SD-card and if all fails can boot into TAQOZ. There are even two options from SD, one is a bootloader in the MBR of the SD, the other one a file in the root directory.

    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 trying to get to the point where I can get TAQOZ to run in spinsim.

    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...
  • I haven't implemented smart pins in spinsim yet, so the WRPIN isn't supported. If you want to try C you can download p2gcc from the thread at http://forums.parallax.com/discussion/166470/cant-wait-for-propgcc-on-the-p2/p1 . You will also need to install SimpleIDE because p2gcc uses the PropGCC compiler.
  • __red__ wrote: »
    (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.)

Sign In or Register to comment.