Shop OBEX P1 Docs P2 Docs Learn Events
What causes "bootsdcard" to fail? — Parallax Forums

What causes "bootsdcard" to fail?

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2012-08-29 14:51 in Propeller 1
I've run into a series of unexplainable situations where fsrw's "bootsdcard" routine fails to properly launch another binary.

Can someone give me a idea of what factors would cause this to fail? I thought it had to do with the size of the destination program, but my testing shows this isn't a factor.

From FSRW
pub bootsdcard                                                         

   return sdspi.bootsdcard(datablock, filesize <# $8000)

From SDPIFEMTO
pub bootsdcard(addr,count) | t                                                

  if count < 16                                                                     
    return true
  repeat t from 0 to 7                                                                    
    if (t <> cogid) and (t <> (cog-1))                                                   
        cogstop(t)
  t := iospiboot | iostopldr | cogid                                                    
  long[control][1] := count << 16                                                    
  long[control][0] := (t << 24) | (addr & $ffffff)                         
  repeat while long[control][0] & iotestrdy                                     
  return (long[control][0] & iotesterr) <> 0 

The solution of "simply switch to Kye's isn't going to work, as I need the memory space.
Any help unraveling this would be appreciated.

Thanks

Comments

  • lonesocklonesock Posts: 917
    edited 2012-08-28 20:51
    Which version of FSRW is this?

    Jonathan
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-28 21:15
    The only thing that I know of that will cause this to fail is either an SD card hard read error or a program that's bigger than the extent size. The entire program has to fit in a contiguous region on the SD card and the only way to guarantee this is to use an extent size of 32K or greater. Kye's boot routine avoids this problem by providing a table of the start and size of all extents up to 32K total.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-08-28 21:24
    lonesock wrote: »
    Which version of FSRW is this?

    Jonathan

    2.6
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-08-28 21:25
    Mike Green wrote: »
    The only thing that I know of that will cause this to fail is either an SD card hard read error or a program that's bigger than the extent size. The entire program has to fit in a contiguous region on the SD card and the only way to guarantee this is to use an extent size of 32K or greater. Kye's boot routine avoids this problem by providing a table of the start and size of all extents up to 32K total.

    So I am to understand that the physical size of the program could be a factor here? The one that fails is currently a 15k binary. Others that work fine are various sizes.

    Jeff
  • AribaAriba Posts: 2,690
    edited 2012-08-28 21:35
    The allocated sectors for the file must be contiguous. For bigger files the chance is higher that this is not the case. Sectors inside a cluster are always contiguous so if you format your SD card with 32kB clusters, you are on the safe side. You can do this from the cmd console in Windows with:
    format X: /fs:fat /a:32k
    
    X is your drive letter of the SD card.

    Andy
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-08-29 06:08
    This code isn't in FSRW 2.6. However, it sounds like it might in the femto code, which I have never used. Maybe the particular file that's causing problems is correupted. Can you read it on a Windows or Linux box?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-08-29 14:51
    @Andy,

    Ah! Allocation Units! Ok.. I've got it.

    That seemed to have been the ticket! Programs which were failing seem to be working correctly. Thank you!

    Jeff
    Ariba wrote: »
    The allocated sectors for the file must be contiguous. For bigger files the chance is higher that this is not the case. Sectors inside a cluster are always contiguous so if you format your SD card with 32kB clusters, you are on the safe side. You can do this from the cmd console in Windows with:
    format X: /fs:fat /a:32k
    
    X is your drive letter of the SD card.

    Andy
Sign In or Register to comment.