├── .gitignore
├── BUILD.txt
├── COPYING.txt
├── LICENSE_GPL.txt
├── Makefile
├── Makefile.inc
├── README.md
├── TODO
├── config
├── config.ini
├── devices.dat
├── fx2_kim_dump.hex
├── fx2lp_fw.hex
└── nm.hex
├── docs
├── gen_config
└── romdata.txt
└── src
├── Makefile
├── Makefile.inc
├── libhex
├── HexData.cpp
├── HexData.h
├── Makefile
├── testmyhex.cpp
└── utils.h
├── libini
├── HierINIReader.cpp
├── HierINIReader.h
├── INIReader.cpp
├── INIReader.h
├── LICENSE.txt
├── Makefile
├── README.kim
├── ini.c
└── ini.h
├── programmer
├── AppData.cpp
├── AppData.h
├── DeviceData.cpp
├── DeviceData.h
├── HexFileFormat.h
├── Makefile
├── Programmer.cpp
├── Programmer.h
├── fx2.cpp
├── fx2.h
├── prog.cpp
├── usb.c
├── usb.h
├── utils.c
├── utils.h
└── version.h
├── support
├── app_config.c
└── config_data.h
├── tests
├── Makefile
└── support
│ ├── Makefile
│ ├── config_data.c
│ ├── test.bin
│ ├── test.conf
│ ├── test.hex
│ ├── test1.ref
│ └── test_config_data.c
└── tools
├── Makefile
├── freehex2other.py
├── gen_config.py
├── hex2bin.cpp
├── hexinfo.cpp
└── mergehex.cpp
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled source #
2 | ###################
3 | *.com
4 | *.class
5 | *.dll
6 | *.exe
7 | *.o
8 | *.so
9 | lib*.a
10 |
11 | # Packages #
12 | ############
13 | # it's better to unpack these files and commit the raw source
14 | # git has its own built in compression methods
15 | *.7z
16 | *.dmg
17 | *.gz
18 | *.iso
19 | *.jar
20 | *.rar
21 | *.tar
22 | *.zip
23 |
24 | # Logs and databases #
25 | ######################
26 | *.log
27 | #*.sql
28 | #*.sqlite
29 |
30 | # OS generated files #
31 | ######################
32 | .DS_Store
33 | .DS_Store?
34 | ._*
35 | .Spotlight-V100
36 | .Trashes
37 | ehthumbs.db
38 | Thumbs.db
39 |
40 | # specific files
41 | hex2bin
42 | hexinfo
43 | mergehex
44 | prog
45 | testmyhex
46 | bin
47 |
--------------------------------------------------------------------------------
/BUILD.txt:
--------------------------------------------------------------------------------
1 | make
2 | make install
3 |
4 | As configured 'make install' creates a local bin directory (at the top level dir) and this folder is assumed as the path used by PSOC_compiler demos.
5 | Note that make install only works from the top level folder.
6 |
7 | Other targets
8 | make clean
9 |
10 | some folder have test programs that can be built. They are not built by default.
11 |
--------------------------------------------------------------------------------
/COPYING.txt:
--------------------------------------------------------------------------------
1 | All is published under GPL with the exception of libini.
2 | libini is published under the New BSD license. See the libini directory.
3 |
4 | Copyright (C) 2014 Kim Lester
5 | http://www.dfusion.com.au/
6 |
7 | This Program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | This Program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this Program. If not, see .
19 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SUBDIRS = src
2 |
3 | export TOPDIR := $(shell echo $$PWD)
4 | export INSTALL_DIR=$(TOPDIR)/bin
5 |
6 | .PHONY: all install clean
7 |
8 | all install clean::
9 | for dir in $(SUBDIRS); do \
10 | $(MAKE) -C $$dir $@; \
11 | done
12 |
13 | clean::
14 | $(RM) ./bin/*
15 |
--------------------------------------------------------------------------------
/Makefile.inc:
--------------------------------------------------------------------------------
1 | SUBDIRS ?=
2 |
3 | .PHONY: all install clean
4 |
5 | all install clean::
6 | @for dir in $(SUBDIRS); do \
7 | echo Make $@ in subdir: $$dir; \
8 | $(MAKE) -C $$dir $(DEFS) $@; \
9 | done
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ##PSOC_programmer
2 |
3 | #####Summary
4 | Open source Unix tools to manipulate hex files and program a PSoC5 (ARM) via FX2 USB interface.
5 |
6 | #####Purpose
7 | * Tools to manipulate Intel hex files
8 | * Configure the FX2 USB interface on the CY8CKIT.
9 | * Program a hex file into a PSoC5 (ARM).
10 |
11 |
12 | #####Requirements
13 | * A Cypress CY8CKIT-050 dev kit, however some of the tools are of more general use.
14 | * Developed on OS X, however it is expected to run under Linux (not yet tested)
15 |
16 | #####See Also
17 | * https://github.com/kiml/PSOC_compiler.git
18 | * http://dfusion.com.au/wiki/ The ARM Embedded pages:
19 | - PSoC5 bare metal
20 | - PSoC5 programmer
21 | - GCC Linker
22 |
23 | #####Additional Uses
24 | * A useful general purpose Intel hex manipulation library (libhex)
25 |
26 | #####License
27 | * All code is released under GPL v3 except for:
28 | - libini a the third party library that is released with changes under its original New BSD license.
29 |
30 | #####Raison d'Etre
31 | * Cypress put out a free but closed source MS Windows development environment. They do provide GCC but pretty much everything else is proprietary which is fine but:
32 | - I like the PSoC feature set (basically ARM CPU, mxied signal FPGA, decent analogue)
33 | - I wanted to learn more about internals of the ARM Cortex M3 chip used
34 | - I wanted to program the PSoC under Unix.
35 |
36 | Short version - the mountain was there so I climbed it :-)
37 |
38 | #####Tools
39 |
40 | `prog CMD`
41 | Talk to a PSoC ARM device. CMD is:
42 | ```
43 | program filename - program device
44 | upload filename - read device and save in file
45 | verify filename - verify device
46 | reset - reset device
47 | erase - erase device
48 | id - get jtag id
49 | usb_clear - clear USB error on device
50 | help - display help
51 | ```
52 |
53 | `hex2bin infile.hex outfile.bin`
54 | Converts intel hex files into binary files (note binary files may be quite large)
55 |
56 | `hexinfo filename.hex`
57 | Dumps PSoC specific hex file into something slighly more readable.
58 |
59 | ```
60 | mergehex (-[cdemnp] infile.hex)+ [-o outfile.hex]
61 | mergehex (-[cdemnp] infile.hex)+ > outfile.hex
62 | Eg: mergehex -c infile.hex -nm config.hex > outfile.hex
63 | ```
64 | Merge a newly compiled .hex program file with additional PSoC specific .hex
65 | configuration info to create a programmable hex file.
66 | This is an interim tool - ideally the additional configuration info comes
67 | from human readable config files rather than .hex snippets.
68 |
69 | `freehex2other[.py] [-h] -f OUTPUT_FORMAT [-i INFILE] [-o OUTFILE]`
70 | Convert ASCII hex bytes to other formats
71 |
72 | optional arguments:
73 | -h, --help show this help message and exit
74 | -f OUTPUT_FORMAT output format: hex,intelhex,binary
75 | -i INFILE input file. Default stdin
76 | -o OUTFILE output file. Default stdout
77 |
78 |
79 | `gen_config[.py] [-h] -f OUTPUT_FORMAT [-i INFILE] [-o OUTFILE]`
80 | Compile config data into freehex file format
81 |
82 | optional arguments:
83 | -h, --help show this help message and exit
84 | -i INFILE input file
85 | -o OUTFILE output file. Default stdout
86 |
87 |
--------------------------------------------------------------------------------
/TODO:
--------------------------------------------------------------------------------
1 | ** LICENSE
2 | ** set confi dir = bindir/../config
3 | ** clean up source
4 |
5 | * As at Aug14 running program once results in a stall. If i run ataing I get timeouts. clearing stall fixes this so prog 0; prog 0 (FAILS). prog 0; prog 9; prog 0; WORKS. Also replace 0 with 8....
6 |
7 | * NOTE: my remainder code for fractions of blocks etc may have a bug in it. Check completion on exactly boundary cases
8 | Corrected: int count = (remainder && i==num_blocks-1) ? remainder : blocksize; !?
9 | * need a tool to convert bin to augmented hex (note can use objcopy to convert elf to bin or hex but not enough for programming). Maybe take multiple files as imputs (eg program, config_data, registers
10 | * move configuration code into a hex file - DONE
11 | * read hex file to write flash (check 001-81290 pdf A.1 for details of hex format files and header lines)
12 | * verify
13 | * Maybe add a num cmds counter to request so we can auto-pop the correct number of replies (although we need to understand which have data...
14 | * annotate a hex file (to std out) also for reader. Define config settings etc. A.4 and TRM 43.4 etc
15 | * exit programming mode.
16 | * make sure we don't get timeouts (ie add robustness)
17 | * compare functionality of programmer with windows version
18 | * Can I access Software SW* debug?
19 | * When interface falls over (STALL): "The host tells the firmware to set or clear the stall condition for an end- point using the Set Feature/Stall and Clear Feature/Stall requests. Once the firmware stalls an endpoint, it should not remove the stall until the host issues a Clear Feature/Stall request. An exception to this rule is endpoint 0, which reports a stall condition only for the current transaction and then automatically clears the stall condition."
20 | * Using SWD I may be able to actually control peripherals... 42.3.4
21 |
22 | * Handle 256 and 288 byte data formats - 256 NOT TESTED
23 | * read psoc and put into a hex file. - DONE but need to test reflashing uploaded file
24 | * simplify control info sent to programmer device. - DONE !?
25 | * write config_flash - DONE !?
26 |
27 | * write_flash - DONE
28 | * compile arm code and download it to PSOC. (what arm set etc) - DONE
29 | * Doesn't know where to find hex config file - done
30 | * erase sector, all - DONE
31 | * sort out command line options - DONE
32 | * create a program struct that contains all data (config checksum etc. I think currently it's place in magic locations in HEX file) - DONE !?
33 |
34 |
35 | PSoC programming need
36 | ----------------
37 | * register list header file of all regs
38 | * mapping of jtag id to device name
39 | * maybe copies of precanned logic blocks
40 | * need a config file format for each I/O pin
41 |
42 |
43 | * Demos
44 | * Use UDB PLDs (ch 23.3) to create logic . Can data path be memory mapped ? Can I write a value and read logic results? Can I attach UDB to memory bus and trigger a counter on a certain variable being changed !?
45 | pg 155. Could do a CRC hardware engine in for s/w. Dynamic config etc.
46 |
47 |
48 | ============
49 | Tools
50 |
51 | 1) psoc_ctrl CMD args
52 | // * load file.hex
53 | // * save file.hex
54 | * program/download [file.hex]
55 | * upload [file.hex]
56 | * verify [file.hex]
57 | * psoc_reset
58 | * enter_programming_mode
59 | // * exit_programming_mode
60 | * usb_reset
61 | * debug...
62 | * read_mem ...
63 | * read_reg [NVL|WOL...]...
64 | // * write_mem ...
65 | Option to ';' separate commands on command line: "load file.x;download;verify;reset;"
66 | next only works if prev succeeds
67 |
68 | * CMD: file:file.hex to psoc[:subsystem]
69 | * CMD: file.hex:prog, file.hex:data, file.hex:prot file.hex:regs to psoc[:subsystem]
70 | * CMD: psoc[:subsystem] to file:file.hex
71 |
72 |
73 | 1) psoc_hexfile CMD args
74 | Any file can have extension .hex for hex or .bin for binary or do I determine input type auto but not so output type... ?
75 | * CMD: -c psoc5lp-xyz -p file.hex -d file.hex -s file.hex -r file.hex [-o file.hex] or stdout
76 | * CMD: -c config -i file.hex [-o file.hex|bin]
77 | * CMD: file.hex, -d file.hex, -s file.hex -r file.hex -o file.hex
78 | also a splitter... ?
79 |
80 | * CMD: -c config -i|-ip|-id|-is|-ir file.hex [-o|-op|-od|-os|-or file.hex|bin]
81 | * CMD: -c config [-i(.pdsr) file]* [-o(.pdsr) file]*
82 |
83 | -------
84 |
85 | buildhex could take a config file for misc args also on command line rather than from hex files
86 |
--------------------------------------------------------------------------------
/config/config.ini:
--------------------------------------------------------------------------------
1 | [Programmer]
2 |
3 | fx2_config_file = fx2_kim_dump.hex
4 |
--------------------------------------------------------------------------------
/config/devices.dat:
--------------------------------------------------------------------------------
1 | flash_rows_per_array = 256;
2 |
3 | flash_code_bytes_per_row = 256;
4 | flash_config_bytes_per_row = 32;
5 |
6 | flash_rows_per_protection_byte = 4;
7 |
8 | eeprom_bytes_per_row = 16;
9 |
10 | flash_code_base_address = 0x000000;
11 | flash_config_base_address = 0x800000; // 0x4..800000 ?
12 | eeprom_base_address = 0x40008000;
13 |
14 | [PSOC5LP-xxx]
15 |
16 | flash_num_arrays = 4;
17 | flash_size = 262144;
18 | eeprom_size = 2048; // FIXME: CORRECT THIS (depends on part #)
19 |
--------------------------------------------------------------------------------
/config/fx2lp_fw.hex:
--------------------------------------------------------------------------------
1 | :03000000020357A1
2 | :03000B00021D686B
3 | :0200330061FA70
4 | :03004300020500B3
5 | :03005300020500A3
6 | :10020000BB010689828A83E0225002E722BBFE02FC
7 | :10021000E32289828A83E49322BB010CE58229F5DB
8 | :1002200082E5833AF583E0225006E92582F8E6224A
9 | :10023000BBFE06E92582F8E222E58229F582E58304
10 | :100240003AF583E49322BB010689828A83F0225027
11 | :1002500002F722BBFE01F322F8BB010DE58229F56E
12 | :1002600082E5833AF583E8F0225006E92582C8F654
13 | :1002700022BBFE05E92582C8F222BC000BBE002984
14 | :10028000EF8DF084FFADF022E4CCF875F008EF2F8D
15 | :10029000FFEE33FEEC33FCEE9DEC984005FCEE9D4A
16 | :1002A000FE0FD5F0E9E4CEFD22EDF8F5F0EE842066
17 | :1002B000D21CFEADF075F008EF2FFFED33FD4007C7
18 | :1002C000985006D5F0F222C398FD0FD5F0EA22A38C
19 | :1002D000F8E0C5F025F0F0E582158270021583E0A4
20 | :1002E000C838F0E8227401FF3395E0FEFDFC0808F1
21 | :1002F00008E62FFFF618E63EFEF618E63DFDF61876
22 | :10030000E63CFCF622D083D082F8E49370127401AC
23 | :1003100093700DA3A393F8740193F5828883E4731B
24 | :100320007402936860EFA3A3A380DFEF4E6012EF27
25 | :1003300060010EEDBB010B89828A83F0A3DFFCDE36
26 | :10034000FA2289F05007F709DFFCA9F022BBFEFC76
27 | :10035000F309DFFCA9F022787FE4F6D8FD75812F40
28 | :1003600002039E0206EFE493A3F8E493A34003F68E
29 | :100370008001F208DFF48029E493A3F85407240CE9
30 | :10038000C8C333C4540F4420C8834004F4568001CA
31 | :1003900046F6DFE4800B010204081020408090053F
32 | :1003A000B8E47E019360BCA3FF543F30E509541FBD
33 | :1003B000FEE493A360010ECF54C025E060A840B8CE
34 | :1003C000E493A3FAE493A3F8E493A3C8C582C8CA4C
35 | :1003D000C583CAF0A3C8C582C8CAC583CADFE9DE1F
36 | :1003E000E780BE00010202030304040505E5AA201C
37 | :1003F000E003121D9F22D322D32253D8EF32D322FF
38 | :100400001201000200000040B4042BF13900010386
39 | :1004100002010A06000200000040010009023C003F
40 | :1004200001010080FA0904000006FF000000070532
41 | :100430000103400010070581034000100705020278
42 | :100440000002000705840200020007058602000280
43 | :10045000000705080200020009023C0001010080BB
44 | :10046000320904000006FF000000070501034000F8
45 | :100470001007058103400010070502024000000735
46 | :1004800005840240000007058602400000070508B9
47 | :1004900002400000040309041003430079007000C7
48 | :1004A0007200650073007300260347004600580081
49 | :1004B00032004C0050003500350035003500350065
50 | :1004C000350035003500370038003900410014038D
51 | :1004D0004600580032004C0050002D0047004500F7
52 | :1004E0004E00000090E60AE054F0600A90E50DE04E
53 | :1004F000C330E403D322D322C20490E6BAE022320E
54 | :100500000212000002122E0002121C000212400011
55 | :1005100002125400021280000204FF000212BD0009
56 | :100520000212BE000212BF000212C0000212C1007D
57 | :100530000212C2000212C3000212C4000212C5005D
58 | :100540000212C6000212BD000212C7000212C80049
59 | :100550000212C9000212CA000212CB000212CC0021
60 | :100560000212CD000212BD000212BD000212BD0037
61 | :100570000212CE000212CF000212D0000212D100ED
62 | :100580000212D2000212D3000212D4000212D500CD
63 | :100590000212D6000212D7000212D8000212D900AD
64 | :1005A0000212DA000212DB000212DC000212DD008D
65 | :1005B0000212DE000212DF0041E0B00144E09DDEE5
66 | :1005C000ADBEEF41E0980041E0990041E09A00495A
67 | :1005D000E049373131316900000E3149E02B3737BE
68 | :1005E0003737000000003744E0381002050044E0CF
69 | :1005F00042A9307EEA41E0B50041E0B601008E0C30
70 | :100600008F0D90E600E054187012E50D2401FFE410
71 | :10061000350CC313F50CEF13F50D801590E600E0D3
72 | :100620005418FFBF100BE50D25E0F50DE50C33F573
73 | :100630000CE50D150DAE0C7002150C4E6005120682
74 | :10064000DE80EE2230040990E680E0440AF0800764
75 | :1006500090E680E04408F07FDC7E051205FE90E61F
76 | :100660005D74FFF090E65FF05391EF90E680E05408
77 | :10067000F7F02290E682E030E004E020E60B90E61E
78 | :1006800082E030E119E030E71590E680E04401F0C7
79 | :100690007F147E001205FE90E680E054FEF022A951
80 | :1006A00007AE2DAF2E8F828E83A3E064037017AD4B
81 | :1006B0000119ED7001228F828E83E07C002FFDEC0A
82 | :1006C0003EFEAF0580DFE4FEFF2290E682E044C0FC
83 | :1006D000F090E681F04387010000000000227400E2
84 | :1006E000F58690FDA57C05A3E582458370F922E49B
85 | :1006F000F50BF50AF509F508C203C200C202C201F2
86 | :10070000120BB8752304752400752B04752C127513
87 | :10071000210475221C752904752A58752D04752E1F
88 | :1007200094D2E843D82090E668E04409F090E65C73
89 | :10073000E0443DF0D2AF12115490E680E020E10495
90 | :10074000D204D14490E680E054F7F0538EF8C2030F
91 | :1007500071ED300104F183C2013003F471F650F001
92 | :10076000C203D1CA20001690E682E030E704E02000
93 | :10077000E1F090E682E030E604E020E0E5D173713C
94 | :10078000F880CD90E6B9E0700302083314700302DC
95 | :10079000087C24FE70030208CF24FB700302082F9C
96 | :1007A00014700302082B14607A14607B2405600324
97 | :1007B000020907120F79400302091290E6BBE024F8
98 | :1007C000FE602914603A24FD60111460292406702B
99 | :1007D00050E52390E6B3F0E524803E91E440030227
100 | :1007E0000902E52B90E6B3F0E52C802DE52590E697
101 | :1007F000B3F0E5268023E52790E6B3F0E5288019DD
102 | :1008000090E6BAE0FF12069FAA06A9077B01EA4913
103 | :100810004B600CEE90E6B3F0EF90E6B4F0211221BD
104 | :10082000022102D1A52112F1902112F1882112D1C9
105 | :10083000902112F17B4002211290E6B8E0247F6003
106 | :100840001514601924027032A200E43325E0FFA2DF
107 | :1008500002E4334F8016E490E740F08014B1F44096
108 | :10086000047D0180027D00D11AE0540190E740F040
109 | :10087000E4A3F0D19D7402F021122102F17D400227
110 | :10088000211290E6B8E024FE6013240260022112D7
111 | :1008900090E6BAE0B40104C2008077806590E6BAC1
112 | :1008A000E0702AB1F440047D0180027D00D11AE09D
113 | :1008B00054FEF090E6BCE05480131313541FFFE085
114 | :1008C000540F2F90E683F0E04420F080458033F110
115 | :1008D0007F503F90E6B8E024FE6019240270239018
116 | :1008E000E6BAE0B40104D200802890E6BAE06402DF
117 | :1008F0006020800EB1F440047D0180027D00D11A99
118 | :10090000800C90E6A080073114500790E6A0E044E8
119 | :1009100001F0C112D204C20590E6B9E01203050944
120 | :10092000834009854109834209904309C74409CDA1
121 | :100930004509CD4609CD4709CD4809CD490A874A21
122 | :100940000A874B0A874C0A874D0A874E09CD4F0903
123 | :10095000D15009EC5109EC520A87530A875409F027
124 | :10096000550A34560A6E570A76580A875B0A875C1E
125 | :100970000A8F5F0AA9600ABA610A1F640B2D6A0018
126 | :10098000000A8780481204F8543F90E097F0411D18
127 | :100990001204F830E70CA3E090E0A7F0D14B9111DE
128 | :1009A000800F90E6BAE0543FFF7B017AE079A7918F
129 | :1009B0003890E0A8EFF090E0A8E0B40104D14B41FA
130 | :1009C000837D017F0161B3C20491B161B5C204802E
131 | :1009D0004CC204E490E68BF090E6A0E020E1F97BC5
132 | :1009E000017AE77940F1A212115441B2C20441B236
133 | :1009F0001204F890E056F0E024F9601724FA600B36
134 | :100A000014701890E027745AF0801290E027747DDB
135 | :100A1000F0800A90E02774FAF08002D1C141B2124E
136 | :100A200004F8600843B3045390FB800643900453DA
137 | :100A3000B3FB807EC20490E6B9E0FD90E027E0FBC6
138 | :100A4000E4F510F511FF915A90E6B9E0FD90E056FB
139 | :100A5000E0F510E4F511FB7F01915A90E6B9E0FD55
140 | :100A6000751001751101E4FB7F02915A61B5120402
141 | :100A7000F8FD7F39802FC2047F39B1E090E0A7E014
142 | :100A8000FD7F39D1AD61B5C2047D037F0261B31230
143 | :100A900004F890E0B6F07F11B1E090E0A7E04414D4
144 | :100AA000F0E0FD7F1191116129C20490E092E030E5
145 | :100AB000E20280757D067F0461B31204F8703591FF
146 | :100AC00030EF70067D027F0361B390E0A7E054F73A
147 | :100AD000B1D970067D027F0361B3B1E870067D0273
148 | :100AE0007F0361B390E0A7E0543FB1D2703B7D0239
149 | :100AF0007F0361B39130EF70067D027F0361B39095
150 | :100B0000E0A7E04408B1D970067D027F0361B3B16C
151 | :100B1000E870067D027F0361B390E0A7E044C0B1B6
152 | :100B2000D270067D027F0361B3D13B61B5E4F50C61
153 | :100B30007440250CF582E434E7F583E4F0050CE518
154 | :100B40000CB440EC90E740746AF0E4A3F090E03C11
155 | :100B5000E090E742F090E03DE090E743F090E03E27
156 | :100B6000E090E744F090E03FE090E745F090E098B7
157 | :100B7000E090E746F090E099E090E747F090E09A47
158 | :100B8000E090E748F0E490E68AF000000090E68B01
159 | :100B90007410F0000000C204D112E490E03CF0A315
160 | :100BA000F0A3F0A3F090E09AF090E099F090E09834
161 | :100BB000F08002D158A2042290E600E054E74412EB
162 | :100BC000F090E60174C0F090E60B7403F0D1CEF122
163 | :100BD00098C2061212E0E490E09BF090E03604F038
164 | :100BE000E490E035F090E0B2F090E0B1F090E0B643
165 | :100BF000F090E0AFF090E026F0D1C153B1FE53B1D8
166 | :100C0000FD43B60F90E029E4F0A37440F043AF0732
167 | :100C100022AE07AF05EEC39440501274582ED1880F
168 | :100C2000EFF0EE24F070031213417F01227F0022C7
169 | :100C30007AE079A77B017F10EFC394405019EF242D
170 | :100C4000EE700890E09CE090E06AF074582FD18834
171 | :100C5000E01202467F01227F00228F0D8D0E8B0F46
172 | :100C6000EF75F004A42440F974E735F0FA7B01E451
173 | :100C7000120246D16BE50E120258900002E50F12E7
174 | :100C80000258E510D1B5E50D90E0B770057404F099
175 | :100C90008004E02404F0E5116016E490E68AF00098
176 | :100CA000000090E0B7E090E68BF0E490E0B7D1115F
177 | :100CB00022750D01750EE7750F407E007F0E7D00D9
178 | :100CC000B1CB12032BD13F12020054F7120246445B
179 | :100CD000101202464420120246440412024654FCFA
180 | :100CE000440212024690E056E0B1CB90000212029C
181 | :100CF0005890E027E0900003120258900004E4129C
182 | :100D0000025890E097E0543F90000512025890007E
183 | :100D10000512021914601024FD600C24FC600824E4
184 | :100D2000FC6004240C705A7AE079A99134EF7027A2
185 | :100D3000D13F120200FFC413135401FDEF54BFFF53
186 | :100D4000ED44015401C4333354C04F120246B1CBB9
187 | :100D500074031202468033B1CB900005120219646D
188 | :100D600001600D90E0A9E07F0120E3027F00800B8D
189 | :100D700090E0A9E07F0020E3027F0190000BEF806C
190 | :100D800006B1CB90000BE4120258B1CB90000C746A
191 | :100D9000FF12025890000D74FF1202589000087460
192 | :100DA000FF12025890000974FF12025890E058E0B8
193 | :100DB00090000A120258900006E4120258900007B0
194 | :100DC0007401120258D19C740E8046AB0DAA0EA974
195 | :100DD0000F22FD7F119111EF22FD7F109111EF2263
196 | :100DE0007B017AE079A781387B017AE079A77F11CE
197 | :100DF0009138EF2290E6BCE0547EFF7E00E0D39471
198 | :100E0000807C0022120258E490E68AF0740290E698
199 | :100E10008BF090E6A0E04480F022EC4EFEED4F24F3
200 | :100E2000E3F58274033EF583E493FF3395E0FEEF30
201 | :100E300024A1FFEE34E68F82F58322D16480C5AB16
202 | :100E40000DE50F2401F9E4350EFA2290E6BAE054DC
203 | :100E50003FFF90E0A7E0FD227B017AE77940EFD1E8
204 | :100E60006BED80A07B017AE77940E41202469000A6
205 | :100E70000122AE03D164EF120258900002ED12027B
206 | :100E800058EED1B574048086F582E434E0F583220F
207 | :100E9000E51AD19804F0D32290E740F0E490E68A76
208 | :100EA000F090E68B22E519D19804F0D322AB05AD82
209 | :100EB000077F4380BD900003120258E490E68AF059
210 | :100EC0002290E02774A5F090E056740BF02290E693
211 | :100ED000047480F00000007402F00000007404F05C
212 | :100EE0000000007406F00000007408F0000000E448
213 | :100EF000F000000090E682E054FCF0E044C4F0E42E
214 | :100F000090E670F000000090E61074A0F000000081
215 | :100F100090E611F000000090E61274A2F0000000CC
216 | :100F200090E61374E2F000000090E614F000000078
217 | :100F300090E6157420F0000000E490E618F0000040
218 | :100F40000090E619F000000090E61AF00000009012
219 | :100F5000E61BF000000000000090E602F000000038
220 | :100F600090E603F000000090E6497482F000000073
221 | :100F7000F0000000F1810203FED322D322D322D35A
222 | :100F800022E4F5B175B6FF2290E6BAE0F51AD32255
223 | :100F900090E6BAE0F519D3225389F1438901538EC3
224 | :100FA000F722AB017512067D087C007F508F0D8CF7
225 | :100FB0000E8D0F8A108B11E4F513E513C3951250B3
226 | :100FC0004B1210F4400122C3E50E94014008E50ED7
227 | :100FD0001210FE4001221210FC40081210EC1210F8
228 | :100FE00024C3220511E511AE107002051014F5821C
229 | :100FF0008E83E01210CE4001221210ECAF0D110EC4
230 | :10100000050FE50F7002050E051380AED3228F1475
231 | :101010001124AF14312111D211EC112490E678E0A3
232 | :1010200030E1EF2290E678E020E6F9228F0D8C0E79
233 | :101030008D0F8B108A11891290E67AE054FEF01120
234 | :10104000F4400790E6787440F022C3E50E94014026
235 | :1010500007E50E11FE40012211FC400411EC80C492
236 | :1010600090E6787480F0E50D25E0440111CE400152
237 | :1010700022E513B4010690E6787420F090E679E05A
238 | :10108000F51411D2400122E4F514E514C395135070
239 | :101090003BE51314FFB5140690E6787440F0E513B1
240 | :1010A00024FEB5140690E6787420F090E679E0AB63
241 | :1010B00010AA11A912851482758300120258EF65D7
242 | :1010C00014600511D2400122051480BED32290E69F
243 | :1010D00079F0313B90E678E0FB20E004312F70F4AA
244 | :1010E000EB20E20431477002C322D32290E678E07D
245 | :1010F0004440F0221124AF0D31218006E50F90E627
246 | :1011000079F0313B90E678E0FB20E004312F70F479
247 | :10111000EB20E20431477002C322EBD320E101C38C
248 | :101120002290E6787480F0EF25E090E679F022785E
249 | :101130001574FF1202E7EC4D4E4F2274FFF518F5BF
250 | :1011400017F51675150022AF18AE17AD16AC15ECD5
251 | :101150004D4E4F2290E0A97404F0A374B6F07B01C9
252 | :101160007AE079A17513067D087C007F50112C5020
253 | :1011700062E4F9E9C39418505CE91313543F24A1C5
254 | :1011800031E9C431E040027E07E91313543FFDEF1B
255 | :1011900024302EFF31D729F582E43AF583EFF0E9C8
256 | :1011A000240131F2F074A12D31E931E040027E07D3
257 | :1011B000EF24302EFFE92402FDE433FC31D72DF576
258 | :1011C00082EA3CF583EFF0E9240331F2F07404295C
259 | :1011D000F980A0C322D32290E0A9E0FAA3E0FB2289
260 | :1011E000540FFFD394097E0022F582E434E0F583A6
261 | :1011F000E022FFE433FEEB2FF582EA3EF583E422A2
262 | :10120000C0E0C083C082D20151157401F0D082D0F9
263 | :1012100083D0E032F05391EF90E65D22C0E0C083CE
264 | :10122000C08251157404F0D082D083D0E032C0E087
265 | :10123000C083C08251157402F0D082D083D0E032D6
266 | :10124000C0E0C083C082D20351157408F0D082D0B0
267 | :1012500083D0E032C0E0C083C082852925852A265C
268 | :1012600051B2852127852228517651147410F0D06F
269 | :1012700082D083D0E032852882852783A374072219
270 | :10128000C0E0C083C08290E680E030E71185212570
271 | :1012900085222651B2852927852A285176F090E0AB
272 | :1012A000297402F0A3E451147420F0D082D083D0CA
273 | :1012B000E032852682852583A37402F02232323201
274 | :1012C00032323232323232323232323232323232FE
275 | :1012D00032323232323232323232323232323232EE
276 | :1012E000E490E028F090E09C7421F0E490E037F086
277 | :1012F00090E048F090E047F090E057F0FF743C2F0A
278 | :10130000F582E434E0F583E4F074522FF582E4349E
279 | :10131000E0F583E4F00FBF04E47F3F90E059E4F090
280 | :10132000A3DFFC90E05874FFF090E0927403F0E4C7
281 | :1013300090E040F053B5FD53B5FE43B00143B00219
282 | :101340002290E037EFF030E708E0C4540790E04027
283 | :10135000F090E037E04404F022913F715FB1045314
284 | :10136000B5FE90E037E05403601414600D1460067D
285 | :101370008000C2B1D2B1C2B1D2B1C2B1D2B1C2B198
286 | :10138000D2B1228E0F8F10B1DCB1F324FE60201495
287 | :10139000600714601A2403704091E453B0FDE5B077
288 | :1013A0005401F51143B002B1BF602CD113802890D5
289 | :1013B000E037E030E21491E4C2B1D2B1E5B05401BB
290 | :1013C000F511B1BF6011D113800D715FE4FFE4909E
291 | :1013D000E67CF00FBF04F7E149715FD144F022C20F
292 | :1013E000B1A2B092F0D2B1C2B1A2B092F1D2B1C268
293 | :1013F000B1A2B092F2D2B1C2B1A2B092F3D2B1C254
294 | :10140000B1A2B092F4D2B1C2B1A2B092F5D2B1C23F
295 | :10141000B1A2B092F6D2B1C2B1A2B092F7D2B1AF3E
296 | :10142000F02243B50190E67BE0FF913F90E67BE040
297 | :10143000FF913F90E67BE0FF913F90E67BE0FF8FDE
298 | :101440001F851FF0C2B1A2F092B0D2B1C2B1A2F119
299 | :1014500092B0D2B1C2B1A2F292B0D2B1C2B1A2F3F3
300 | :1014600092B0D2B1C2B1A2F492B0D2B1C2B1A2F5DF
301 | :1014700092B0D2B1C2B1A2F692B0D2B1C2B1A2F7CB
302 | :1014800092B0D2B1228D0FEB4A6006B1138F10805B
303 | :101490000690E041E0F510E50F6002B1DCB1F371B8
304 | :1014A0005F90E057E024FE601C24FE601824037067
305 | :1014B0002F9122E510600543B001800353B0FEC2B6
306 | :1014C000B1D2B1801990E037E030E2129122E510FC
307 | :1014D000600543B001800353B0FEC2B1D2B1E1490F
308 | :1014E000D144F02253B5FE71DF90E67CEFF071DF5E
309 | :1014F00090E67CEFF071DF90E67CEFF071DF90E634
310 | :101500007CEFF022B1D590E098B1D2A3B1D2A3F094
311 | :10151000D2B1228E128F13E4F5140513E513700275
312 | :101520000512B140B1CB70020512B140B1CB7002CF
313 | :101530000512B140B1CB70020512B1405401FF2237
314 | :1015400014F5828E83E0FFB14FEF2514F514228F3E
315 | :101550001D751E00E51D30E002051EE51DC313F5D7
316 | :101560001DE51D30E002051EE51DC313F51DE51D3B
317 | :1015700030E002051EE51DC313F51DE51D30E00238
318 | :10158000051EE51DC313F51DE51D30E002051EE532
319 | :101590001DC313F51DE51D30E002051EE51DC31337
320 | :1015A000F51DE51D30E002051EE51DC313F51DE523
321 | :1015B0001D30E002051EE51DC313F51DAF1E22718F
322 | :1015C0005FAF10AE0FB113EF6511220513E513AE37
323 | :1015D0001222F0D2B1C2B1A2B0E4332253B0FE4322
324 | :1015E000B5010000D11BD11B90E028E0FF913F53D3
325 | :1015F000B5FE22715FB10490E099E025E0FF90E034
326 | :1016000098E04FFF90E09AE0FE25E025E04F90E063
327 | :1016100057F02290E09CE04408F022C2B1D2B1C25F
328 | :10162000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C2E2
329 | :10163000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C2D2
330 | :10164000B1D2B12253B5FE43B00143B00290E09C49
331 | :10165000E0440722D16443B5017F9E913F7FE7912B
332 | :101660003F53B5FE43B50290E036E0FFEF7002E174
333 | :101670004243B00143B501C2B1D2B1C2B1D2B1C28D
334 | :10168000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C282
335 | :10169000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C272
336 | :1016A000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C262
337 | :1016B000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C252
338 | :1016C000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C242
339 | :1016D000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C232
340 | :1016E000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C222
341 | :1016F000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C212
342 | :10170000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C201
343 | :10171000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C2F1
344 | :10172000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B1C2E1
345 | :10173000B1D2B1C2B1D2B1C2B1D2B1C2B1D2B15340
346 | :10174000B5FE90E0477401F02253B5FE43B001436B
347 | :10175000B00290E09CE090E057FFE0FEEF4E90E09A
348 | :101760009CF0228B0F8A108911E4FFE4FEF1A05453
349 | :1017700001AB12AA13A914120246F1A0C31312025C
350 | :101780004674012514F514E43513F5130EBE08DD77
351 | :1017900074012511F511E43510F5100FBF04CC22AA
352 | :1017A000AB0FAA10A91102020090E037E0FF90E011
353 | :1017B00000EFF090E001E4F090E037E0FFEF440448
354 | :1017C000FF90E037EFF090E0287499F090E0027419
355 | :1017D00099F090E03C74DBF090E03D7406F090E00E
356 | :1017E0003E740CF090E03F747BF07EE07F3CB113E0
357 | :1017F00090E041EFF07B017AE0793CC003C002C089
358 | :10180000017B017AE079038B128A138914D001D00D
359 | :1018100002D0031217637B017AE0790390E023EB97
360 | :10182000F0A3EAF0A3E9F0751B00E51BC3940440A4
361 | :1018300002414D90E001E0FFEF6002414DE51B7079
362 | :101840003C43B3045390FB43B50243B50143B0019D
363 | :1018500043B002751C00E51CC394045012AF1C7405
364 | :10186000522FF582E434E0F583E4F0051C80E77F35
365 | :10187000647E0091A543900453B3FB800343B501FC
366 | :1018800075F099C2B1A2F092B0D2B1C2B1A2F192F8
367 | :10189000B0D2B1C2B1A2F292B0D2B1C2B1A2F392AF
368 | :1018A000B0D2B1C2B1A2F492B0D2B1C2B1A2F5929B
369 | :1018B000B0D2B1C2B1A2F692B0D2B1C2B1A2F79287
370 | :1018C000B0D2B153B5FEC2B1D2B1C2B1A2B0E4330D
371 | :1018D000FF90E098EFF0D2B1C2B1A2B0E433FF9034
372 | :1018E000E099EFF0D2B1C2B1A2B0E433FF90E09A38
373 | :1018F000EFF0D2B1C2B1D2B143B50175F0DBC2B1E4
374 | :10190000A2F092B0D2B1C2B1A2F192B0D2B1C2B142
375 | :10191000A2F292B0D2B1C2B1A2F392B0D2B1C2B12E
376 | :10192000A2F492B0D2B1C2B1A2F592B0D2B1C2B11A
377 | :10193000A2F692B0D2B1C2B1A2F792B0D2B175F014
378 | :1019400006C2B1A2F092B0D2B1C2B1A2F192B0D2AD
379 | :10195000B1C2B1A2F292B0D2B1C2B1A2F392B0D2EE
380 | :10196000B1C2B1A2F492B0D2B1C2B1A2F592B0D2DA
381 | :10197000B1C2B1A2F692B0D2B1C2B1A2F792B0D2C6
382 | :10198000B175F00CC2B1A2F092B0D2B1C2B1A2F165
383 | :1019900092B0D2B1C2B1A2F292B0D2B1C2B1A2F3AE
384 | :1019A00092B0D2B1C2B1A2F492B0D2B1C2B1A2F59A
385 | :1019B00092B0D2B1C2B1A2F692B0D2B1C2B1A2F786
386 | :1019C00092B0D2B175F07BC2B1A2F092B0D2B1C2E6
387 | :1019D000B1A2F192B0D2B1C2B1A2F292B0D2B1C270
388 | :1019E000B1A2F392B0D2B1C2B1A2F492B0D2B1C25C
389 | :1019F000B1A2F592B0D2B1C2B1A2F692B0D2B1C248
390 | :101A0000B1A2F792B0D2B1C2B190E041E0FFEF24B1
391 | :101A1000FF92B0D2B1C2B153B5FE90E098E0FFEFB3
392 | :101A2000601690E099E0FFEF700E90E09AE0FFEF13
393 | :101A3000700690E0017401F07B017AE0790390E098
394 | :101A400023EBF0A3EAF0A3E9F0051B012A90E001E3
395 | :101A5000E0FFEF7002817B43B5017F8B1213594386
396 | :101A6000B5017B017AE0793890E023EBF0A3EAF04E
397 | :101A7000A3E9F090E023E0FBA3E475F0011202CFAC
398 | :101A8000A9F0FA120200FF12143F90E023E0FBA33A
399 | :101A9000E475F0011202CFA9F0FA120200FF12144D
400 | :101AA0003F90E023E0FBA3E475F0011202CFA9F020
401 | :101AB000FA120200FF12143F90E023E0FBA3E4754A
402 | :101AC000F0011202CFA9F0FA120200FF12143F53E4
403 | :101AD000B0FEC2B1D2B1000053B0FD90E098E0FF7B
404 | :101AE000EF601690E099E0FFEF700E90E09AE0FF53
405 | :101AF000EF700690E0017401F090E001E0FFEF70FC
406 | :101B000002817B43B5017FBB12135943B5017B01B1
407 | :101B10007AE0794290E023EBF0A3EAF0A3E9F090B9
408 | :101B2000E023E0FBA3E475F0011202CFA9F0FA1262
409 | :101B30000200FF12143F90E023E0FBA3E475F001E4
410 | :101B40001202CFA9F0FA120200FF12143F90E02314
411 | :101B5000E0FBA3E475F0011202CFA9F0FA12020033
412 | :101B6000FF12143F90E023E0FBA3E475F0011202A2
413 | :101B7000CFA9F0FA120200FF12143F43B001C2B124
414 | :101B8000D2B1000053B0FD90E098E0FFEF601890F4
415 | :101B9000E099E0FFEF701090E09AE0FFEF7008909E
416 | :101BA000E0017401F080617B017AE07942AE02AF1E
417 | :101BB00001EEFF7E00EF54FFF59A7B017AE0794257
418 | :101BC000AF01EF54FFF59B7FBB12135943B5019052
419 | :101BD000E67BE0FF12143F90E67BE0FF12143F909B
420 | :101BE000E67BE0FF12143F90E67BE0FF12143F908B
421 | :101BF000E041E0FFEF600543B001800353B0FEC257
422 | :101C0000B1D2B1000053B0FD90E001E0FFEF606B96
423 | :101C100090E03CE4F090E02874A5F07B017AE07954
424 | :101C20003CAE02AF01EEFF7E00EF54FFF59D7B015D
425 | :101C30007AE0793CAF01EF54FFF59E7EE07F3C12E5
426 | :101C4000138390E09CE0FFEF20E230751C00E51C60
427 | :101C5000C394045020AF1C743C2FF582E434E0F5AB
428 | :101C600083E0FFAE1C744D2EF582E434E0F583EF83
429 | :101C7000F0051C80D990E0017401F090E001E0FFD4
430 | :101C8000EF600E90E09C7431F090E0477401F080BA
431 | :101C90000B90E09C7427F090E047E4F090E001E0C6
432 | :101CA000FFEF24FF22C20690E0B3E4F0A304F0911A
433 | :101CB000B8200603208CFA22AD07AC06ED4C700369
434 | :101CC000D20622C206ECD3943F40067C007D018000
435 | :101CD00015EDAE047802C333CE33CED8F9FDAC0691
436 | :101CE0006305FF6304FFEDF58AECF58CC28DD2A984
437 | :101CF000D2AFD28C22C20674BFF58A746380EB7FA8
438 | :101D0000107E277C007D0A12027A90E0B3EEF0A3E9
439 | :101D1000EFF04E700790E0B3F0A304F080D7E5AA8F
440 | :101D200020E002D32291FF000000000000E5AA306D
441 | :101D3000E0033006F2300602C322B163D322ED90F5
442 | :101D4000E695F0E5AA20E302D32291FF000000000F
443 | :101D50000000E5AA30E3033006F2300602C322B1E8
444 | :101D600063D322C28CC28D22C0E0C083C082C0D0A7
445 | :101D700075D000C00690E0B4E024FFF090E0B3E03E
446 | :101D800034FFF0E07002A3E07008C28CC28DD2066E
447 | :101D9000800291F5D006D0D0D082D083D0E032E45A
448 | :101DA00090E09CF090E069E0FF20E202C171122116
449 | :101DB000CDEF54FB90E069F090F001E090E038F056
450 | :101DC00090F002E090E039F090F003E090E03AF01B
451 | :101DD00090F004E090E03BF090F006E090E042F0FC
452 | :101DE00090F007E090E043F090F008E090E044F0DD
453 | :101DF00090F009E090E045F01217A990E092E050D1
454 | :101E00000F4404F090E0A774E0F0A37449F0800D53
455 | :101E100054FBF090E0A774E0F0A3742BF01221CDF6
456 | :101E200090E0AD12212C9409EE9400502D90E0A783
457 | :101E3000E475F0011202CF85F082F583E0FD7400B5
458 | :101E40002FF58274F43EF583EDF090E0AEE004F0FF
459 | :101E5000700690E0ADE004F080C6E490E694F000F7
460 | :101E6000000090E0ADA3E090E695F00000000221B4
461 | :101E70001AE5AA30E30302211412219E0000001289
462 | :101E80002171A3F0A3F074F0F59A7400F59B7AF435
463 | :101E900079007EF47F0074F4F59D7400F59EA3E054
464 | :101EA0007004A3E0641E703290F000E0B4F02BA345
465 | :101EB000E0B4F02612165412215590E67C742112DB
466 | :101EC0002137700312212190E0ABE07004A3E0649D
467 | :101ED0000F70E71221BE740F805190E0ADE07004E6
468 | :101EE000A3E06410702D90F000E0B40F26A3E0B4DE
469 | :101EF000012112215590E67B12213370031221211A
470 | :101F000090E0ABE07004A3E0641070E91221BE74AD
471 | :101F100010801890E0ADE07002A3E0701590E09C96
472 | :101F20007440F090E67CF01221BE04F012211A02F7
473 | :101F30002103750D01E50D700302210390E0ADE072
474 | :101F4000FEA3E090E0A912218740030220ECE49078
475 | :101F5000E09C122128ED9FEC9E400A12211AB11E2E
476 | :101F6000500312217F1221AC90E0281221C5700687
477 | :101F700090E0A9E004F090E028E030E20302203F86
478 | :101F8000E4F50C12212990E0AAE09F90E0A9E09EE0
479 | :101F9000401012211AB11E500912219E0000001299
480 | :101FA00021711221ACFF122192EF1221C57006900F
481 | :101FB000E0A9E004F0050CE50CC3940440C590E0F2
482 | :101FC00037E030E72C90E03CE090E06CF090E03DB2
483 | :101FD000E090E06DF090E03EE090E06EF090E03F49
484 | :101FE000E090E06FF090E09CE090E04012175980A4
485 | :101FF00026750E0A74E0F59A743CF59BE490E09C1B
486 | :10200000F07EE07F3C7B01FA7D01121485150EE520
487 | :102010000E6004315D60DD90E09CE04420312831A9
488 | :10202000664010313F000000121D3E50067AF479E0
489 | :1020300000314D90E09C313370023121021F3C9001
490 | :10204000E037E030E73090E06CE090E03CF090E08A
491 | :102050006DE090E03DF090E06EE090E03EF090E0CA
492 | :102060006FE090E03FF090E09CE0FF90E040E044C3
493 | :102070002012175B8026750E0AE490E09CF074E055
494 | :10208000F59D743CF59E7EE0FF121383150EE50E60
495 | :102090006004315D60E390E09CE0442090E040F01B
496 | :1020A00090E029E0FEA3E090E0AB3187501374008C
497 | :1020B0002DF58274F43CF59D74002DF582E582F5D2
498 | :1020C0009EE4F50CE50CC394054003021F3C312946
499 | :1020D0003166400C313F000000121D3E5002314D70
500 | :1020E0003192313370023121050C80D8311AE5AAC2
501 | :1020F00020E00A319E0000003171021F35E4F50D29
502 | :10210000021F3590E0AB3142000000ED90E695F003
503 | :102110000000002290E09C7480F090E6497482F008
504 | :102120002290E0ABE004F022F090E029E0FEA3E092
505 | :10213000FFC322E090E67CF090E0ACE004F0229057
506 | :10214000E029E0FCA3E0FDEC90E694F02274F4F5C5
507 | :102150009D7400F59EE490E0ABF0A3F02290E09C2B
508 | :10216000E0540764072290E0ACE09F90E0ABE09E73
509 | :102170002290E690E0FE90E0ADE04EF0A3E0F0E4C7
510 | :1021800090E0A9F0A3F022FFE0FCA3E0FDC39FECE8
511 | :102190009E22743C250CF582E434E0F5832290E61F
512 | :1021A00091E0FF90E0ADE4F0A3EFF02290E0A9E031
513 | :1021B000FEA3E02400F58274F03EF583E02290E077
514 | :1021C000ABE4F0A322F090E0AAE004F022E490E077
515 | :0521D000ADF0A3F022B8
516 | :00000001FF
517 |
--------------------------------------------------------------------------------
/config/nm.hex:
--------------------------------------------------------------------------------
1 | :0200000490006A
2 | :0400000000004005B7
3 | :0200000490105A
4 | :04000000AFAC90BC55
5 | :0200000490501A
6 | :0C00000000012BA014770000000000009D
7 | :00000001FF
8 |
--------------------------------------------------------------------------------
/docs/gen_config:
--------------------------------------------------------------------------------
1 | Utility: gen_config(.py)
2 |
3 | Overview
4 | --------
5 |
6 | This utility is used to create configuration data (address and data) values
7 | to initialise microcontroller configuration registers.
8 | It creates a list of various data structures. Each structure is designed
9 | to optimise one common type of data initialisation requirement (eg constant
10 | fill, data copy etc). The data may be stored anywayre in FLASH but on PSOC
11 | is typically stored in the so called FLASH "configuration" area. A C function
12 | is supplied to walk the list, decode and action each entry.
13 |
14 | Source File Format
15 | ------------------
16 |
17 | Grammer:
18 | #include "filename.h"
19 | #define NAME VALUE
20 | #label NAME ADDRESS
21 |
22 | addr : value * count # Source type 1
23 | addr : value # Source type 2
24 | addr : hex bytes.... [ @ width ] # Source type 3 NOTE: dest width not currently supported
25 | addr : [src_addr] [* count] # Source type 4 Default count 1
26 |
27 | Future: ??
28 | addr : [off:value]+ # Source type 5
29 |
30 | Labels:
31 | * Labels are an additional construct. They are output unchanged in the
32 | freehex output format. Their purpose is to add metadata to the output file (eg data load address)
33 |
34 | * FIXME: True or not: only one label is currently permitted and it must occur before any "addr:" lines.
35 | * FIXME: Should any coalescence be prevented from crossing label locations so that labels can be used to
36 | create distinct config data sets (eg with diff load addresses) in a single file.
37 |
38 |
39 | Notes:
40 | * addr, value, count may be expressed in standard C (well Python)
41 | format, decimal, hex (0x...) etc.
42 |
43 | * normal C include files can be used to pull in #define lines.
44 | FIXME: This tool does not currently support #define macros or defines with expressions on RHS.
45 |
46 | * A count == 0 in the source file is not valid.
47 |
48 | * Source Types and Output types more or less match trivially.
49 | Source Type -> Output Table Type (TT)
50 | 1 1 CF Constant Fill
51 | 2 ** 3 or 2. It depends. See below **
52 | 3 3 DA Data Array (single value is most compact)
53 | 4 4 AC Address Copy (memcpy)
54 |
55 | * A single byte value could be INPUT using Source Types 1, 2 or 3
56 | * For a single byte Source Type 3 syntactically reduces to Source Type 2.
57 | * For a single byte all three source types (1,2,3) reduce to the same
58 | internal format. Therefore single bytes will always be output in a
59 | consistent format regardless of source construct.
60 |
61 | * A single byte may be OUTPUT using Output Types 1 (CF), 2 (OV), 3(DA)
62 | The most compact representation for a single byte happens to be DA.
63 | Thus DA is the canonical format for outputting a single byte.
64 |
65 | However a group of single byte values in a config file will often be
66 | within a small address range. Therefore a run of single byte values
67 | within an address range of 256 bytes can be efficiently coded using
68 | output type 2 offset,value (OV).
69 | Thus Output Type 2 (OV) is automatically generated as needed and
70 | cannot be explicitly specified in the Source File unless Source Type 5
71 | is implemented (to support entering small address offsets).
72 |
73 | Limits:
74 | Constant Fill: count <= 65536
75 | Data Array: <= 256 bytes
76 | Address Copy: <= 256 bytes
77 | Offset Value: address offset range <= 255 (count <=256 but offset <= 255)
78 |
79 |
80 | Output Modes
81 | ------------
82 | * there are two output modes - strictly in source order and optimised
83 | (within a label group?). The optimisation mode groups multiple
84 | single value type 2 items into a CFG_TT_OV structure where possible.
85 |
86 | * It is possible to write an address twice. A realistic use case is to zero
87 | a large block (CF) and then sparse write values into it later.
88 | With output mode preserving source order it is up to the data file creator
89 | to put the block fill before any sparse fill of individual values.
90 | * Optimised mode gathers Source Type 2 entries together to compress storage space.
91 | To permit bulk fills and sparse writes to the same space the general
92 | rule is bulk fills first then sparse.
93 | In practice the key rule is probably only:
94 | In output file put CF (bulk fill) before others.
95 | An additional refinement might be CF before AC before others too.
96 |
97 | To ensure results are determinant between version the following order is
98 | used when output is optimised (LHS output/executed first):
99 |
100 | CF -> AC -> DA(multi) -> OV -> DA(single)
101 |
102 | Note that DA multi is like AC so it comes before OV and DA single
103 |
104 |
105 | Output/Memory Data Structure
106 | ----------------------------
107 |
108 | The top level entity is a list of data structures. The first byte of a
109 | structure contains the structure type, the list ends with an element
110 | type of CFG_TT_END. There are 4 types of initialisation structure:
111 | Type: 1: constant fill, 2: data fill, 3:offset,value, 4: mem to mem copy
112 |
113 | Note: to permit count to handle common values of 256/65536 the stored count value has 1 added to it.
114 | Therefore a count of 0 is not possible.
115 |
116 | list structure:
117 | [ HEADER ELEMENT ]* 0000
118 | ->
119 | [ ttcc aaaa aaaa ELEMENT ]* 0000
120 | tt: type
121 | cc: count_low - 1 # add 1 to get real count (ie stored 0 -> count=1, 1->2 etc)
122 | a...a: 32 bit address
123 | 0000 is the list terminating value of ttcc
124 |
125 |
126 | ELEMENT tt == 1: constant fill (CF)
127 | ccvv
128 | cc: count_hi
129 | vv: value
130 |
131 | ELEMENT tt == 2: offset value (OV)
132 | [ oovv ]+
133 | oo: offset
134 | vv: value
135 | "oovv" structure repeats cc (count_low) times
136 |
137 | ELEMENT tt == 3: data array (DA)
138 | [ vv ]+
139 | vv: value
140 | "vv" structure repeats cc (count_low) times
141 |
142 | ELEMENT tt == 4: address copy (AC)
143 | ssss ssss
144 | s...s: 32 bit (source) address
145 |
146 |
147 | Note:
148 | * For compactness addresses (eg 32 bit addresses) are NOT aligned on usual
149 | memory boundaries. Note that ARMv7-M can handle unaligned 16/32 bit reads (not 64) IIRC,
150 | Form ARMv6 and earlier can do byte reads and reconstruct any 16/32 bit values.
151 |
--------------------------------------------------------------------------------
/docs/romdata.txt:
--------------------------------------------------------------------------------
1 | Overview
2 | --------
3 |
4 | This utility is used to create configuration data (address and data) values
5 | to initialise microcontroller configuration registers.
6 | It creates a list of various data structures. Each structure is designed
7 | to optimise one common type of data initialisation requirement (eg constant
8 | fill, data copy etc). The data may be stored anywayre in FLASH but on PSOC
9 | is typically stored in the so called FLASH "configuration" area. A C function
10 | is supplied to walk the list, decode and action each entry.
11 |
12 |
13 | Memory Data Structure
14 | ---------------------
15 |
16 | The top level entity is a list of data structures. The first byte of a
17 | structure contains the structure type, the list ends with an element
18 | type of CFG_TT_UNDEF. There are 4 types of initialisation structure:
19 | Type: 1: constant fill, 2: offset,value, 3: data fill, 4: mem to mem copy
20 |
21 | list structure:
22 | [ HEADER ELEMENT ]* 0000
23 | ->
24 | [ ttcc aaaa aaaa ELEMENT ]* 0000
25 | tt: type
26 | cc: count_low
27 | a...a: 32 bit address
28 | 0000 is the list terminating value of ttcc
29 |
30 | ELEMENT tt == 1: constant fill
31 | ccvv
32 | cc: count_hi
33 | vv: value
34 |
35 | ELEMENT tt == 2: offset value
36 | [ oovv ]+
37 | oo: offset
38 | vv: value
39 | "oovv" structure repeats cc (count_low) times
40 |
41 | ELEMENT tt == 3: data array
42 | [ vv ]+
43 | vv: value
44 | "vv" structure repeats cc (count_low) times
45 |
46 | ELEMENT tt == 4: address copy
47 | ssss ssss
48 | s...s: 32 bit (source) address
49 |
50 | Note:
51 | * For compactness addresses (eg 32 bit addresses) are NOT aligned on usual
52 | memory boundaries.
53 |
54 |
55 | Source File Format
56 | ------------------
57 |
58 | Grammer:
59 | #include "filename.h"
60 | #define NAME VALUE
61 | #label NAME [@ADDRESS]
62 |
63 | addr : value [* count] # type 1
64 | addr : value # type 2
65 | addr : hex bytes.... [ @ width ] # type 3 NOTE: width not currently supported
66 | addr : [src_addr] [* count] # type 4
67 |
68 | Notes:
69 | * addr, value, count may be expressed in standard C (well Python)
70 | format, decimal, hex (0x...) etc.
71 |
72 | * normal C include files should work to pull in #define lines
73 |
74 | * only one label (before "addr:" lines) is currently permitted.
75 |
76 | * there are two output modes - strictly in source order and optimised
77 | (within a label group). The optimisation groups multiple
78 | single value type 2 items into a CFG_TT_OV structure where possible.
79 |
80 | * A single value could be stored via types 1, 2 or 3. The canoncial format is
81 | type 2XXX to allow grouping of other single values.
82 |
--------------------------------------------------------------------------------
/src/Makefile:
--------------------------------------------------------------------------------
1 | SUBDIRS = libhex libini programmer tools
2 |
3 | include ../Makefile.inc
4 |
--------------------------------------------------------------------------------
/src/Makefile.inc:
--------------------------------------------------------------------------------
1 | LIBNAME ?=
2 | PROGNAMES ?=
3 | TESTPROGNAMES ?=
4 | TARGETS = $(LIBNAME) $(PROGNAMES) $(TESTPROGNAMES)
5 |
6 | CC=gcc
7 | CXX=g++
8 | CFLAGS += $(INC)
9 | CPPFLAGS += $(INC)
10 | INSTALL=install
11 | COPY=cp
12 |
13 |
14 | # General Targets
15 |
16 | .PHONY: all install clean
17 |
18 | all: $(TARGETS)
19 |
20 | install::
21 | ifdef PROGNAMES
22 | @if [ x"$(INSTALL_DIR)" = x"" ] ; then \
23 | echo INSTALL_DIR is not set; \
24 | exit 1; \
25 | else \
26 | echo Install directory: $(INSTALL_DIR); \
27 | echo Installing: $(PROGNAMES); \
28 | mkdir -p $(INSTALL_DIR); \
29 | $(INSTALL) $(PROGNAMES) $(INSTALL_DIR); \
30 | fi
31 | endif
32 | ifdef SCRIPTNAMES
33 | @if [ x"$(INSTALL_DIR)" = x"" ] ; then \
34 | echo INSTALL_DIR is not set; \
35 | exit 1; \
36 | else \
37 | echo Install directory: $(INSTALL_DIR); \
38 | echo Installing: $(SCRIPTNAMES); \
39 | mkdir -p $(INSTALL_DIR); \
40 | $(INSTALL) $(SCRIPTNAMES) $(INSTALL_DIR); \
41 | fi
42 | endif
43 |
44 |
45 |
46 | clean::
47 | rm -f *.o $(TARGETS)
48 |
49 |
50 | # General Rules
51 |
52 | $(LIBNAME): $(OBJS)
53 | $(RM) -f $(LIBNAME)
54 | $(AR) cr $(LIBNAME) $(OBJS)
55 |
56 |
57 | %.o: %.cpp
58 | $(CXX) $(CPPFLAGS) -c $<
59 |
60 | %.o: %.cc
61 | $(CXX) $(CPPFLAGS) -c $<
62 |
63 | %.o: %.c
64 | $(CC) $(CFLAGS) -c $<
65 |
66 | #%.a: %.o
67 | # $(RM) -f $@
68 | # $(AR) cr $@ $.*o
69 |
70 | .o.a:
71 | $(RM) -f $@
72 | $(AR) cr $@ $.*o
73 |
74 | %.d: %.c
75 | $(SHELL) -ec '$(CC) -M $(CFLAGS) $< \
76 | | sed '\"s/$*\\.o[ :]*/& $@/g'\" > $@'
77 |
78 |
--------------------------------------------------------------------------------
/src/libhex/HexData.h:
--------------------------------------------------------------------------------
1 | #ifndef _MYHEX_H
2 | #define _MYHEX_H
3 |
4 | /*
5 | Copyright (C) 2014 Kim Lester
6 | http://www.dfusion.com.au/
7 |
8 | This Program is free software: you can redistribute it and/or modify
9 | it under the terms of the GNU General Public License as published by
10 | the Free Software Foundation, either version 3 of the License, or
11 | (at your option) any later version.
12 |
13 | This Program is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | GNU General Public License for more details.
17 |
18 | You should have received a copy of the GNU General Public License
19 | along with this Program. If not, see .
20 | */
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | typedef std::vector v_uint8_t;
28 |
29 | //#include "types.h"
30 | //#include "utils.h"
31 |
32 |
33 | // Intel Hex File Format.
34 | // :CCAAAATTDDDDD...DDDKK
35 | // where
36 | // ':' literal character (start code)
37 | // CC line data byte count (hex)
38 | // AAAA address (hex)
39 | // TT record type (hex) (see below)
40 | // DD.. data
41 | // KK checksum : 2's compl. of LSB of sum of line contents (binary byte values) except ':' and KK
42 |
43 | // Record (Block) Type
44 | #define RT_DATA 0
45 | #define RT_END 1
46 | #define RT_EXT_SEG_ADDR 2
47 | #define RT_START_SEG_ADDR 3
48 | #define RT_EXT_LIN_ADDR 4
49 | #define RT_START_LIN_ADDR 5
50 |
51 | struct HexData;
52 |
53 |
54 | struct Block
55 | {
56 | v_uint8_t data;
57 | unsigned max_len;
58 | uint32_t base_address;
59 | uint8_t type;
60 |
61 | Block(unsigned _max_len);
62 | Block(uint32_t address, const uint8_t *src, uint32_t src_len, uint8_t type=RT_DATA);
63 | Block(uint32_t address, v_uint8_t vdata);
64 |
65 | uint8_t calculate_checksum(void) const;
66 | void clear(void);
67 | void dump(FILE *fp=NULL, int max_bytes=0) const;
68 | int length(void) const { return data.size(); }
69 | uint8_t *ptr(void) { return data.data(); }
70 | };
71 |
72 |
73 | // ============
74 | typedef std::vector Blockset;
75 |
76 | struct HexData
77 | {
78 | Blockset blockset;
79 |
80 | public:
81 |
82 | enum {BIGENDIAN, LITTLEENDIAN};
83 |
84 | HexData();
85 | //HexData(const char *filename=NULL, uint32_t default_base_address=0);
86 | // HexData(uint32_t base_address, uint8_t *data, int len);
87 | HexData(uint32_t base_address, v_uint8_t vdata);
88 |
89 | // HexData& operator=(const HexData& other);
90 | // HexData (const HexData& other);
91 |
92 | // high level
93 | bool read_hex(const char *filename, uint32_t default_base_address=0);
94 | bool write_hex(const char *filename) const;
95 | bool write_hex_data(FILE *fp, unsigned int width=0) const;
96 | void _write_hex_data(FILE *fp) const;
97 |
98 | void add(const Block &block);
99 | void add(uint32_t base_address, v_uint8_t vdata);
100 | void add_hex(uint32_t base_address, const char *hex_str);
101 | HexData *reshape(int new_max_len) const;
102 | HexData *canonicalise(void) const { return reshape(0); }
103 |
104 | HexData *extract(uint32_t start_address, uint32_t address_length) const;
105 | v_uint8_t extract2vector(uint32_t start_address, uint32_t address_length) const;
106 | uint8_t *extract2bin(uint32_t start_address, uint32_t address_length, uint8_t *data=NULL) const;
107 |
108 | //Block &operator[](std::size_t i) { return (*blockset)[i]; }
109 | //const Block &operator[](std::size_t i) const { return const_cast(*blockset)[i]; }
110 | Block *operator[](std::size_t i) { return blockset[i]; }
111 | const Block *operator[](std::size_t i) const { return const_cast(blockset[i]); }
112 |
113 | // support
114 | void dump(FILE *fp=NULL, int max_bytes=0) const;
115 | int nblocks(void) const { return blockset.size(); }
116 | int length(void) const;
117 | //int length(uint32_t start_address, uint32_t address_length) const;
118 | bool minmax_address(uint32_t range_start_address, uint32_t range_address_length, uint32_t *min_address, uint32_t *max_address) const;
119 |
120 | void trim(void);
121 | void clear(void) { blockset.clear(); }
122 | uint32_t uint_at(uint32_t address, unsigned int len, uint8_t endian) const;
123 |
124 | static uint32_t parse_hex_int(const char **hex_buffer, int num_hex_digits);
125 | static uint8_t *hexstr2bin(const char *hex_buffer, int num_hex_digits, uint8_t *bin_buffer);
126 | static const char *type_str(int type);
127 |
128 | static void write_block_record(FILE *fp, const Block *block);
129 | static void write_ext_address_record(FILE *fp, uint32_t high_address);
130 | static void write_end_record(FILE *fp);
131 | static void write_raw_record(FILE *fp, uint32_t address, uint8_t type, const uint8_t *data, int len);
132 | static void write_raw_record(FILE *fp, uint32_t address, uint8_t type, const v_uint8_t data);
133 | static void write_hex_record(FILE *fp, uint32_t address, uint8_t type, const uint8_t *data, int len);
134 | static void write_hex_record(FILE *fp, uint32_t address, uint8_t type, const v_uint8_t data);
135 | };
136 |
137 | #endif
138 |
--------------------------------------------------------------------------------
/src/libhex/Makefile:
--------------------------------------------------------------------------------
1 | LIBNAME=libhex.a
2 | OBJS = HexData.o
3 | TESTPROGNAMES=testmyhex
4 |
5 | testmyhex: testmyhex.o libhex.a
6 | $(CXX) -o $@ $< -L. -lhex
7 |
8 | include ../Makefile.inc
9 |
--------------------------------------------------------------------------------
/src/libhex/testmyhex.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2014 Kim Lester
3 | http://www.dfusion.com.au/
4 |
5 | This Program is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | This Program is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this Program. If not, see .
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include "HexData.h"
26 | #include "utils.h"
27 |
28 |
29 | #if 0
30 | void f(const char *msg, int block_start_address, int block_len, int start_address, int end_address)
31 | {
32 | fprintf(stderr,"%s: BSA:%d, BL:%d, SA:%d, EA:%d\n", msg, block_start_address, block_len, start_address, end_address);
33 | int block_end_address = block_start_address + block_len;
34 | int start_offset = block_start_address - start_address;
35 | int end_offset = end_address - block_end_address;
36 | int max_0_so = MAX(0, start_offset);
37 | int num_bytes = block_len + MIN(0, start_offset) + MIN(0, end_offset);
38 |
39 | fprintf(stderr,"%s COPY(data + %d, bsid + %d, len=%d)\n\n", num_bytes <= 0 ? "Don't" : "",
40 | max_0_so, MAX(0,-start_offset), num_bytes);
41 |
42 | }
43 | #endif
44 |
45 | bool testcheck(int testnum, const uint8_t *testdata, const uint8_t *refdata, int n)
46 | {
47 | if (memcmp(testdata, refdata, n) == 0)
48 | {
49 | fprintf(stderr, "Test %d: Passed\n", testnum);
50 | return true;
51 | }
52 |
53 | int i;
54 | fprintf(stderr, "Test %d: Failed\n", testnum);
55 | // print differencecs
56 | fprintf(stderr, "TestData: ");
57 | for (i=0;iextract2bin(addr_start, len);
199 | testcheck(testnum, data, refdata, len);
200 | free(data);
201 |
202 | testnum = 11; // above
203 | addr_start = 512;
204 | len = 64;
205 | fprintf(stderr, "Test %d: %s, %d - %d\n", testnum, "above", addr_start, addr_start + len);
206 | hdata = test1.extract(addr_start, len);
207 | data = hdata->extract2bin(addr_start, len);
208 | testcheck(testnum, data, refdata, len);
209 | free(data);
210 |
211 | testnum = 12; // across lower boundary
212 | addr_start = 128;
213 | len = 200;
214 | fprintf(stderr, "Test %d: %s, %d - %d\n", testnum, "across lower boundary", addr_start, addr_start+len);
215 | hdata = test1.extract(addr_start, len);
216 | data = hdata->extract2bin(addr_start, len);
217 | setref(refdata, 256 - addr_start, 256 - (256 - addr_start), 0, true);
218 | testcheck(testnum, data, refdata, len);
219 | free(data);
220 |
221 | testnum = 13;
222 | addr_start = 511;
223 | len = 64; // across upper boundary
224 | fprintf(stderr, "Test %d: %s, %d - %d\n", testnum, "across upper boundary", addr_start, addr_start+len);
225 | hdata = test1.extract(addr_start, len);
226 | data = hdata->extract2bin(addr_start, len);
227 | memset(refdata, 0, 256);
228 | refdata[0] = 255;
229 | testcheck(testnum, data, refdata, len);
230 | free(data);
231 |
232 | testnum = 14; // exact length
233 | addr_start = 256;
234 | len = 256;
235 | fprintf(stderr, "Test %d: %s, %d - %d\n", testnum, "exact length", addr_start, addr_start+len);
236 | hdata = test1.extract(addr_start, len);
237 | data = hdata->extract2bin(addr_start, len);
238 | setref(refdata, 0, len, 0, true);
239 | testcheck(testnum, data, refdata, len);
240 | free(data);
241 |
242 | testnum = 15; // inside
243 | addr_start = 300;
244 | len = 64;
245 | fprintf(stderr, "Test %d: %s, %d - %d\n", testnum, "inside", addr_start, addr_start+len);
246 | hdata = test1.extract(addr_start, len);
247 | data = hdata->extract2bin(addr_start, len);
248 | setref(refdata, 0, len, 300-256, true);
249 | testcheck(testnum, data, refdata, len);
250 | free(data);
251 |
252 | testnum = 16; // outside
253 | addr_start = 128;
254 | len = 512;
255 | fprintf(stderr, "Test %d: %s, %d - %d\n", testnum, "outside", addr_start, addr_start+len);
256 | hdata = test1.extract(addr_start, len);
257 | data = hdata->extract2bin(addr_start, len);
258 | memset(refdata, 0, 512);
259 | setref(refdata+128, 0, 256, 0, false);
260 | testcheck(testnum, data, refdata, 512);
261 | free(data);
262 |
263 | testnum = 17; // exact length (one block)
264 | addr_start = 288;
265 | len = 32;
266 | fprintf(stderr,"Test %d: %s, %d - %d\n", testnum, "exact length (one block)", addr_start, addr_start+len);
267 | hdata = test1.extract(addr_start, len);
268 | data = hdata->extract2bin(addr_start, len);
269 | setref(refdata, 0, len, 288-256, true);
270 | testcheck(testnum, data, refdata, len);
271 | free(data);
272 |
273 | testnum = 18; // inside (one block)
274 | addr_start = 290;
275 | len = 12;
276 | fprintf(stderr,"Test %d: %s, %d - %d\n", testnum, "inside (one block)", addr_start, addr_start+len);
277 | hdata = test1.extract(addr_start, len);
278 | data = hdata->extract2bin(addr_start, len);
279 | setref(refdata, 0, len, 290-256, true);
280 | testcheck(testnum, data, refdata, len);
281 | free(data);
282 |
283 |
284 | #if 0
285 | // HexData hexdata("test.hex");
286 | // HexData hexdata("fx2lp_fw.hex");
287 | HexData hexdata("CapSense_CSD_Design01.hex");
288 | hexdata.dump(stdout);
289 | // hexdata.write_hex("tst.hex");
290 |
291 | //HexData *newhexdata = hexdata.reshape(32);
292 | int newsize = 0; // 32
293 | HexData *newhexdata = hexdata.reshape(newsize);
294 | assert(newhexdata);
295 | #endif
296 |
297 | #if 0
298 | int size = newhexdata->blockset.size();
299 | int i;
300 | for(i=0; iblockset[i];
303 | assert(block != NULL);
304 | block->dump();
305 | }
306 | #else
307 | // newhexdata->dump(stdout);
308 | // if (newsize > 0 && newsize < 256)
309 | // newhexdata->write_hex("testout.hex");
310 | #endif
311 |
312 | #if 0
313 | uint8_t * data = hexdata.extract2bin(32, 0x1000);
314 | dump_data(stdout, data, 512);
315 |
316 | f("b above", 20,10, 10, 18);
317 | f("b encomp", 20,10, 22, 28);
318 | f("b below", 20,10, 31, 38);
319 | f("b border top", 20,10, 15, 22);
320 | f("b border bottom", 20,10, 25, 32);
321 | f("b inside", 20,10, 18, 33);
322 | #endif
323 | }
324 |
--------------------------------------------------------------------------------
/src/libhex/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef _UTILS_H
2 | #define _UTILS_H
3 |
4 | /*
5 | Copyright (C) 2014 Kim Lester
6 | http://www.dfusion.com.au/
7 |
8 | This Program is free software: you can redistribute it and/or modify
9 | it under the terms of the GNU General Public License as published by
10 | the Free Software Foundation, either version 3 of the License, or
11 | (at your option) any later version.
12 |
13 | This Program is distributed in the hope that it will be useful,
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | GNU General Public License for more details.
17 |
18 | You should have received a copy of the GNU General Public License
19 | along with this Program. If not, see .
20 | */
21 |
22 | // FIXME: Don't actually have dest types so to_Uxx is academic
23 | #define B4LE_to_U32(c) (((c)[3]<<24) | ((c)[2] << 16) | ((c)[1] << 8) | (c)[0] )
24 | #define B4BE_to_U32(c) (((c)[0]<<24) | ((c)[1] << 16) | ((c)[2] << 8) | (c)[3] )
25 | #define B2LE_to_U32(c) (((c)[1] << 8) | (c)[0] )
26 | #define B2BE_to_U16(c) (((c)[0] << 8) | (c)[1] )
27 |
28 | #ifndef MIN
29 | #define MIN(a,b) ((a) <= (b) ? (a) : (b))
30 | #endif
31 |
32 | #ifndef MAX
33 | #define MAX(a,b) ((a) >= (b) ? (a) : (b))
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/src/libini/HierINIReader.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2014 Kim Lester
2 | // All rights reserved.
3 | // This code is released under same license (New BSD) as the inih reader it is based upon.
4 |
5 | #include
6 |
7 | #include "HierINIReader.h"
8 |
9 | using std::string;
10 |
11 |
12 | string HierINIReader::Get(string section, string name, string default_value)/*, bool search_parent)*/
13 | {
14 | // Hierarchy is dotted. Eg: [a.b.c].name -> [a.b].name -> [a].name -> [""].name
15 | // where [""] is any initial unnamed section if it exists.
16 |
17 | string key = MakeKey(section, name);
18 |
19 | if (_values.count(key))
20 | return _values[key];
21 |
22 | // if (!search_parent)
23 | // return default_value;
24 | if (section.length() == 0) // already looked at top level - give up
25 | return default_value;
26 |
27 | size_t pos = section.rfind(".");
28 | section = (pos == string::npos) ? "" : section.substr(0,pos-1);
29 |
30 | //return Get(section, name, default_value, search_parent);
31 | return Get(section, name, default_value);
32 | }
33 |
34 |
35 | uint32_t HierINIReader::GetUint32(string section, string name, uint32_t default_value)
36 | {
37 | string valstr = Get(section, name, "");
38 | const char* value = valstr.c_str();
39 | char* end;
40 | // This parses "1234" (decimal) and also "0x4D2" (hex)
41 | uint32_t n = (uint32_t) strtol(value, &end, 0);
42 | return end > value ? n : default_value;
43 | }
44 |
45 |
--------------------------------------------------------------------------------
/src/libini/HierINIReader.h:
--------------------------------------------------------------------------------
1 | #ifndef __HIERINIREADER_H__
2 | #define __HIERINIREADER_H__
3 |
4 | #include
5 | #include "INIReader.h"
6 |
7 | class HierINIReader: public INIReader
8 | {
9 | public:
10 | HierINIReader(std::string filename) : INIReader(filename) {};
11 |
12 | // Get a string value from INI file, returning default_value if not found.
13 | // Hierarchy is dotted. Eg: [a.b.c].name -> [a.b].name -> [a].name -> [""].name
14 | // where [""] is any initial unnamed section if it exists.
15 | std::string Get(std::string section, std::string name,
16 | std::string default_value); // , bool search_parent=true);
17 |
18 | uint32_t GetUint32(std::string section, std::string name, uint32_t default_value);
19 | };
20 |
21 | #endif // __HIERINIREADER_H__
22 |
--------------------------------------------------------------------------------
/src/libini/INIReader.cpp:
--------------------------------------------------------------------------------
1 | // Read an INI file into easy-to-access name/value pairs.
2 |
3 | #include
4 | #include
5 | #include
6 | #include "ini.h"
7 | #include "INIReader.h"
8 |
9 | using std::string;
10 |
11 | INIReader::INIReader(string filename)
12 | {
13 | _error = ini_parse(filename.c_str(), ValueHandler, this);
14 | }
15 |
16 | int INIReader::ParseError()
17 | {
18 | return _error;
19 | }
20 |
21 | string INIReader::Get(string section, string name, string default_value)
22 | {
23 | string key = MakeKey(section, name);
24 | return _values.count(key) ? _values[key] : default_value;
25 | }
26 |
27 | long INIReader::GetInteger(string section, string name, long default_value)
28 | {
29 | string valstr = Get(section, name, "");
30 | const char* value = valstr.c_str();
31 | char* end;
32 | // This parses "1234" (decimal) and also "0x4D2" (hex)
33 | long n = strtol(value, &end, 0);
34 | return end > value ? n : default_value;
35 | }
36 |
37 | double INIReader::GetReal(string section, string name, double default_value)
38 | {
39 | string valstr = Get(section, name, "");
40 | const char* value = valstr.c_str();
41 | char* end;
42 | double n = strtod(value, &end);
43 | return end > value ? n : default_value;
44 | }
45 |
46 | bool INIReader::GetBoolean(string section, string name, bool default_value)
47 | {
48 | string valstr = Get(section, name, "");
49 | // Convert to lower case to make string comparisons case-insensitive
50 | std::transform(valstr.begin(), valstr.end(), valstr.begin(), ::tolower);
51 | if (valstr == "true" || valstr == "yes" || valstr == "on" || valstr == "1")
52 | return true;
53 | else if (valstr == "false" || valstr == "no" || valstr == "off" || valstr == "0")
54 | return false;
55 | else
56 | return default_value;
57 | }
58 |
59 | string INIReader::MakeKey(string section, string name)
60 | {
61 | string key = section + "=" + name;
62 | // Convert to lower case to make section/name lookups case-insensitive
63 | std::transform(key.begin(), key.end(), key.begin(), ::tolower);
64 | return key;
65 | }
66 |
67 | int INIReader::ValueHandler(void* user, const char* section, const char* name,
68 | const char* value)
69 | {
70 | INIReader* reader = (INIReader*)user;
71 | string key = MakeKey(section, name);
72 | if (reader->_values[key].size() > 0)
73 | reader->_values[key] += "\n";
74 | reader->_values[key] += value;
75 | return 1;
76 | }
77 |
--------------------------------------------------------------------------------
/src/libini/INIReader.h:
--------------------------------------------------------------------------------
1 | // Read an INI file into easy-to-access name/value pairs.
2 |
3 | // inih and INIReader are released under the New BSD license (see LICENSE.txt).
4 | // Go to the project home page for more info:
5 | //
6 | // http://code.google.com/p/inih/
7 |
8 | #ifndef __INIREADER_H__
9 | #define __INIREADER_H__
10 |
11 | #include