Shop OBEX P1 Docs P2 Docs Learn Events
Simple SD Card Bootstrap Loader — Parallax Forums

Simple SD Card Bootstrap Loader

wjsteelewjsteele Posts: 697
edited 2010-01-01 17:41 in Propeller 1
I just uploaded a very simple object to the OBEX. It has only one function, to load a file called "Autoexec.bin" from the mounted SD Card's root directory and execute it.

I see here where there was a couple people working on such a loader, but I needed one asap, so I took the FemtoBasic FAT routines and trimmed them way down to the simplest loader.

If it doesn't find the autoexec.bin file, it will simply reboot and try again. You can change the SD IO ports and filename by following the notes in the document.

I use this on my PSM to change software based on which SD card is inserted. (Sort of like game cartridges.) I've also attached it here.

Cheers and Happy New Year!

Bill

Post Edited (wjsteele) : 12/31/2009 9:37:41 PM GMT

Comments

  • TonyWaiteTonyWaite Posts: 219
    edited 2009-12-31 16:37
    Thanks for this object, which is very handy as I too am coding for Rayman's excellent PSM.
    If I am thinking correctly, this works with the existing 256kBit EEPROM, without hardware amendment?
    T o n y
  • wjsteelewjsteele Posts: 697
    edited 2009-12-31 16:47
    That's correct, it does't require anything other than the base eeprom. I've got it working on all my devices with SD cards attached. Including my Hyrda, Prop Demo board, Prop Proto boards as well as the PSM.

    Bill
  • OakGraphicsOakGraphics Posts: 202
    edited 2009-12-31 16:57
    clever. It makes the possibility for field updates to remote customers a little less challenging. Just pop in a new SD card with the latest 'firmware'. smile.gif
    I will have to play with this...
  • wjsteelewjsteele Posts: 697
    edited 2009-12-31 17:06
    Yep... but just remember, it's not flashing the EEPROM... it's simply loading it in RAM. You have to have the SD card installed in order for it to work correctly.

    But, yes, that is exactly what I needed it to do as well.

    Bill
  • mctriviamctrivia Posts: 3,772
    edited 2009-12-31 17:36
    Just so you know there is also a bootloader object that copies to a 64k eeprom so the card is only needed for updates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    24 bit LCD Breakout Board now in. $21.99 has backlight driver and touch sensitive decoder.
  • wjsteelewjsteele Posts: 697
    edited 2009-12-31 21:33
    Yeah... I saw that one, but that would require me adding 64k eeproms to all my devices! wink.gif

    Happy New Year!

    Bill
  • James LongJames Long Posts: 1,181
    edited 2009-12-31 22:24
    wjsteele said...
    Yeah... I saw that one, but that would require me adding 64k eeproms to all my devices! wink.gif

    Happy New Year!

    Bill

    I did the same thing for a boot loader. The actual running code is on an SD, and the eeprom just has the load and restart code.

    Mine has some other actions for it needs to do some basic operations before loading the running code. It's all pretty simple.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
  • mctriviamctrivia Posts: 3,772
    edited 2009-12-31 22:39
    if you can keep your code under what is left of the first 32k you can fit inside a standard 32k eeprom. i chose 64k because price is almost the same and lets me use a full 32k image with no fear of over writing.

    Still good to have different options.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    24 bit LCD Breakout Board now in. $21.99 has backlight driver and touch sensitive decoder.
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-01-01 04:27
    I have the similar requirements hence the recent thread

    Boot mechanism from SD card - ideas ?? http://forums.parallax.com/showthread.php?p=866715

    Now, mctrivia is correct - the price differential between 32KB and 64KB eeproms is negligable. His version reflashes the upper 32KB, so if there is a error during reflashing, the original code in the lower 32KB remains untouched. His code is for when the SD is not usually present, so the code needs to live in flash.

    My requirement always has an SD card. There are already other mechanisms, such as PropDos and PropCmd. I want to pass parameters and also be able to boot various binaries. I am also looking to replace the boot code (eeprom)·into a cheap micro (50c) - either PIC12F22x or MC9RS08 (sot23 or soic8) rather than the 24C256/512 (~$1.50). Actually, the reason is not for cost but the fact I share pins and want to disable the eeprom after booting.

    I am proposing something like this... (using DOS similarities)
      1. The SD card will be checked for FAT16/FAT32
        • If not found the propeller will stop
      2. The SD card will be searched for a filename "AUTOEXEC.BAT"
        • If AUTOEXEC.BAT is not found, continue at Step 5
      3. The first sector of AUTOEXEC.BAT will be read
        • It should contain a "filename.BIN" and·optional·parameters (filename = valid file name)
        • If a valid filename.BIN is not found, or the file does not exist, continue at Step 5
      4. The·binary file "filename.BIN" will be located
        • The file will be·loaded into hub ram
        • The parameters (32 bytes) will be loaded into hub ram at $7FE0
        • The prop will then execute the binary in hub ram
      5. Otherwise, the binary file "BOOTPROP.BIN" will be located, loaded into hub ram, and executed (could be AUTOEXEC.BIN if you prefer)
      6. It "BOOTPROP.BIN" was not found, the propeller will stop (could be AUTOEXEC.BIN if you prefer)


      It was suggested we could use "CONFIG.SYS" for optional parameters. Things like...
      • VGA(16)
      • TV(12)
      • KBD(26,27)
      • FDX(31,30,0,115200)
      • XTAL(16,5000000)······ 'pllx16, 5MHz

      This way, we can define the binary options to run at run time.

      The boot code could also display a list of binaries to run and request an anwer.

      I would also like to use the latest fsrw routines (fsrw26) for my loader, rather that the older fsrw (femto version).

      QUESTION: Which default binary·name is preferred?
      • BOOTPROP.BIN
      • AUTOEXEC.BIN
      • MENU.BIN········· (PropDOS)
      • other·



      ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
      Links to other interesting threads:

      · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
      · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
      · Prop Tools under Development or Completed (Index)
      · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
      · Search the Propeller forums·(uses advanced Google search)
      My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm

      Post Edited (Cluso99) : 1/1/2010 4:38:13 AM GMT
    1. wjsteelewjsteele Posts: 697
      edited 2010-01-01 17:03
      Yep... I saw your other thread as well... however, my intention is to use the rest of the eeprom that is available to load a "default" program, so I'll be shrinking this boot loader down as much as possible to make it "fit."

      I like the idea of the 64k eeprom really well, but I need to get something working on my existing platforms out there as well, so the 64k simply wasn't a choice for me. In the future, our v2 design will have that for sure.

      Now, what I'd love to see is for Parallax to start shipping all of it's products with the 64k eeprom! That's be cool, since it doesn't cost that much anyway. Of course, I'd also love to see a lot more cog ram as well, but I guess I'll have to wait for that. smile.gif

      Cluso99, one other thing I'd love to see in yours is the ability to load a bin file and push it to a secondary prop. That way, when we have our multi-prop platforms, we only have one true boot.

      Something like Autoexec.bin and autoexe2.bin, etc.

      Having a single config.sys would work great with that as well.

      Bill
    2. Cluso99Cluso99 Posts: 18,069
      edited 2010-01-01 17:41
      wjsteele: Yes I understand your minimum version. I want a tiny version also, and a complete version as well that could be loaded from the SD card.

      I am just about to post a version which can program the eeprom lower and/or upper, does the autoexec.bat, bootprop.bin, and can continue with PropCmd/PropDos. It is not properly tested. I will post on my other thread to avoid being OT.

      BTW I need to "push" the code to a secondary prop. RossH has done it, as has Chip.

      ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
      Links to other interesting threads:

      · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
      · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
      · Prop Tools under Development or Completed (Index)
      · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
      · Search the Propeller forums·(uses advanced Google search)
      My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
    Sign In or Register to comment.