Changeset 443
- Timestamp:
- 01/13/11 11:35:18 (2 years ago)
- Location:
- Deliverables/D4.1
- Files:
-
- 2 modified
-
IntelHex.ml (modified) (2 diffs)
-
IntelHex.mli (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D4.1/IntelHex.ml
r442 r443 195 195 unitialized zone in the code memory. 196 196 *) 197 let export_ intel_hexchunk_size max_addressable code_mem =198 let rec aux chunk_size address rbuff lbuff =197 let export_code_memory chunk_size max_addressable code_mem = 198 let rec aux chunk_size address start_address rbuff lbuff = 199 199 if chunk_size = 0 or address = max_addressable then 200 200 lbuff … … 202 202 let code = Physical.WordMap.find (vect_of_int address `Sixteen) code_mem in 203 203 if code = zero `Eight then 204 aux chunk_size (address + 1) [] (rbuff::lbuff)204 aux chunk_size (address + 1) address [] ((start_address, rbuff)::lbuff) 205 205 else 206 aux (chunk_size - 1) (address + 1) (code::rbuff) lbuff206 aux (chunk_size - 1) (address + 1) start_address (code::rbuff) lbuff 207 207 in 208 aux chunk_size 0 [] [] 208 aux chunk_size 0 0 [] [] 209 ;; 210 211 let clean_exported_code_memory = List.filter (fun x -> snd x <> []) 212 ;; 213 214 let process_exported_code_memory = 215 List.map (fun x -> 216 { record_length = vect_of_int (List.length (snd x)) `Eight; 217 record_addr = vect_of_int (fst x) `Sixteen; 218 record_type = Data; 219 data_field = snd x; 220 data_checksum = zero `Eight (* for the time being *) 221 }) 222 ;; 223 224 let pack_exported_code_memory chunk_size max_addressable code_mem = 225 let export = export_code_memory chunk_size max_addressable code_mem in 226 let cleaned = clean_exported_code_memory export in 227 let processed = process_exported_code_memory cleaned in 228 let end_buffer = 229 [{ record_length = zero `Eight; 230 record_addr = zero `Sixteen; 231 record_type = End; 232 data_field = []; 233 data_checksum = zero `Eight 234 }] in 235 processed @ end_buffer 236 ;; -
Deliverables/D4.1/IntelHex.mli
r442 r443 12 12 val intel_hex_of_file: string -> intel_hex_format 13 13 val process_intel_hex: intel_hex_format -> Physical.WordMap.map 14 val export_intel_hex: int -> int -> Physical.WordMap.map -> byte list list 14 15 val pack_exported_code_memory: int -> int -> Physical.WordMap.map -> intel_hex_format
