Changeset 442 for Deliverables


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.

Location:
Deliverables/D4.1
Files:
4 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 [] []
  • Deliverables/D4.1/IntelHex.mli

    r141 r442  
    1212val intel_hex_of_file: string -> intel_hex_format
    1313val process_intel_hex: intel_hex_format -> Physical.WordMap.map
     14val export_intel_hex: int -> int -> Physical.WordMap.map -> byte list list
  • Deliverables/D4.1/Physical.ml

    r161 r442  
    1010   val find : key -> map -> byte
    1111   val add : key -> byte -> map -> map
     12   val fold : (key -> byte -> 'b -> 'b) -> map -> 'b -> 'b
    1213 end
    1314;;
     
    2122      find k m
    2223    with Not_found -> zero `Eight
     24  let fold = fold
    2325end;;
    2426
     
    3133      find k m
    3234    with Not_found -> zero `Eight
     35  let fold = fold
    3336end;;
    3437
  • Deliverables/D4.1/Physical.mli

    r161 r442  
    1010   val find : key -> map -> byte
    1111   val add : key -> byte -> map -> map
     12   val fold : (key -> byte -> 'b -> 'b) -> map -> 'b -> 'b
    1213 end
    1314;;
Note: See TracChangeset for help on using the changeset viewer.