Changeset 664 for Deliverables/D2.2


Ignore:
Timestamp:
Mar 10, 2011, 11:48:33 AM (9 years ago)
Author:
mulligan
Message:

Changed output of Intel HEX files so we no longer have those gargantuan blocks of zeroes at the end.

Location:
Deliverables/D2.2/8051
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/myocamlbuild_config.ml

    r630 r664  
    1 let parser_lib = "/home/ayache/Downloads/Bol/Deliverables/D2.2/8051/lib"
     1let parser_lib = "/home/dpm/Projects/Cerco/Deliverables/D2.2/8051/lib"
  • Deliverables/D2.2/8051/src/ASM/IntelHex.ml

    r619 r664  
    241241;;
    242242
     243let rec zeros len =
     244  if len = 0 then
     245    []
     246  else
     247    vect_of_int 0 `Eight :: zeros (len - 1)
     248
     249let post_process_exported_code_memory intel_hex =
     250  let reversed = List.rev intel_hex in
     251  let rec aux hex =
     252    match hex with
     253      [] -> []
     254    | he::tl ->
     255        if he.record_type = End then
     256          aux tl
     257        else if he.record_type = Data then
     258          if he.data_field = zeros (int_of_vect he.record_length) then
     259            aux tl
     260          else
     261            he::(aux tl)
     262        else
     263          tl
     264  in
     265    List.rev (aux reversed)
     266
    243267let pack_exported_code_memory chunk_size max_addressable code_mem =
    244268  let export = export_code_memory chunk_size max_addressable code_mem in
    245269  let cleaned = clean_exported_code_memory export in
    246270  let processed = process_exported_code_memory cleaned in
     271  let postprocessed = post_process_exported_code_memory processed in
    247272  let end_buffer =
    248273    [{ record_length = zero `Eight;
     
    252277      data_checksum = vect_of_int 255 `Eight
    253278    }] in
    254     processed @ end_buffer
     279    postprocessed @ end_buffer
    255280;;
    256281
Note: See TracChangeset for help on using the changeset viewer.