Ignore:
Timestamp:
Jan 13, 2011, 10:54:42 AM (9 years ago)
Author:
mulligan
Message:

Partial implementation of Nicolas' requested feature (extraction of code_memory) to Intel HEX format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D4.1/IntelHex.ml

    r140 r442  
    188188  aux Physical.WordMap.empty
    189189;;
     190
     191(* DPM: this needs some comment:
     192     We aim to extract code memory into segmented lists of bytes, with a maximum
     193     length (chunk_size).  The code memory map has a fixed size (max_addressable)
     194     on the 8051.  Further, the chunks we extract get segmented when we find an
     195     unitialized zone in the code memory.
     196*)
     197let export_intel_hex chunk_size max_addressable code_mem =
     198  let rec aux chunk_size address rbuff lbuff =
     199    if chunk_size = 0 or address = max_addressable then
     200      lbuff
     201    else
     202      let code = Physical.WordMap.find (vect_of_int address `Sixteen) code_mem in
     203        if code = zero `Eight then
     204          aux chunk_size (address + 1) [] (rbuff::lbuff)
     205        else
     206          aux (chunk_size - 1) (address + 1) (code::rbuff) lbuff
     207  in
     208    aux chunk_size 0 [] []
Note: See TracChangeset for help on using the changeset viewer.