Changeset 3090


Ignore:
Timestamp:
Jul 30, 2012, 9:11:20 AM (3 years ago)
Author:
wmb
Message:

OLPC ARM - Marvell TIM compiler enhancements for version 4 of the TIM header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/marvell/tim.fth

    r1998 r3090  
    11: >hex  ( n -- n' )  d# 10 /mod h# 10 * +  ;
     2
     30 value tim-version
     4: tim-v3?  ( -- flag )  tim-version h# 00ffff00 and h# 00030400 =  ;
     5
    26: today>hex  ( -- n )
    37   today        ( day month year )
     
    610   rot >hex >r  ( yr century r: hex-month hex-day )
    711   >hex >r      ( yr r: hex-month hex-day hex-century )
    8    >hex r> r> r> bljoin  ( n )
     12   >hex r> r> r>
     13   tim-v3?  if  2swap  then
     14   bljoin  ( n )
    915;
    1016
     
    7278   image-adr image-size free-mem
    7379;
    74 : tim:  \ version trusted ID Processor
    75    0 to last-image-adr
    76    here to tim-adr
    77    hex,
    78    " TIMH" 4c,
    79    hex,        \ Trusted
    80 \  hex,        \ Date
    81    today>hex l,
    82    get-word -4c,  \ OEM ID
    83    get-word 2drop \ Processor
    84 ;
    85 : flash:  \ id (e.g. NAN6)
    86    5 0  do  -1 l,  loop
    87 
     80: id,  ( -- )
    8881   get-word                                   ( adr len )
    8982   \ Convert trailing number to binary byte value - e.g. NAN'6 -> NAN(06)
     
    9285   nip  over 3 + c!  4                                ( adr 4 )
    9386   4c,
     87;
     88: tim:  \ version trusted ID Processor
     89   0 to last-image-adr
     90   here to tim-adr
     91   get-hex dup l,  to tim-version
     92   " TIMH" 4c,
     93   hex,        \ Trusted
     94\  hex,        \ Date
     95   today>hex l,
     96   id,            \ OEM ID
     97   get-word 2drop \ Processor
     98;
     99: flash:  \ id (e.g. NAN6)
     100   5 0  do  -1 l,  loop
     101
     102   id,
    94103
    95104   here to #images-adr   0 l,
     
    113122   over <> abort" Read failed" ( size )
    114123   ifd @ fclose                ( size )
    115 \   h# 1000 round-up
    116     h# 800 round-up
    117 \   4 round-up
     124   \ Older BOOTROMs seem to want the size to be strongly aligned
     125   tim-v3?  if  4  else  h# 800  then  round-up  ( size' )
    118126;
    119127: place-hash  \ XXX need to implement non-null hash info
    120    d# 10 0  do  0 l,  loop
     128   tim-v3?  if
     129      0 l,  \ Size to hash  (should be -1 but 0 is in the examples)
     130      d# 20 l,  \ HashAlgorithmID - SHA-160
     131      d# 16 0  do  0 l,  loop  \ Hash
     132      0 l,   \ Partition number     
     133   else
     134      d# 10 0  do  0 l,  loop  \ Hash
     135   then
    121136;
    122137: +#images  ( -- )  #images-adr l@ 1+ #images-adr l!  ;
     
    169184      here tim-adr -  my-timh-adr 4 la+ l!
    170185      tim-adr  image-adr my-timh-adr 2 la+ l@ +   here tim-adr -  move
     186   else
     187      tim-adr  image-adr   here tim-adr -  move
    171188   then
    172189;
     
    199216   " CMCC" start-package
    200217;
     218: usb:   \ Port# Enabled?
     219   " "(00)USB" start-package hex, hex, end-package
     220;
     221: uart:   \ Port# Enabled?
     222   " "UART" start-package hex, hex, end-package
     223;
     224: cmon:  \
     225   " CMON" start-package end-package
     226;
     227: core:  \ number mapping
     228   " CORE" start-package hex, hex, end-package
     229;
    201230: term:  " Term" start-package end-package  ;
Note: See TracChangeset for help on using the changeset viewer.