Commit graph

10 commits

Author SHA1 Message Date
William Wilgus
12ef045fdf move buflib_free invalid handle check to the function
allow buflib_free to check for invalid or already freed handles
within the function -- remove all the invalid handle guards thru core_free

Change-Id: Ibdcbc82760fc93b674c42283fca420d94907df8e
2022-10-15 09:26:58 -04:00
Aidan MacDonald
e8faf2f2ad buflib: add a common dummy callbacks struct & use it
There are various allocations that can't be moved or shrunk.
Provide a global callback struct for this use case instead of
making each caller declare its own dummy struct.

Also fixed ROLO and x1000 installer code which incorrectly
used movable allocations.

Change-Id: I00088396b9826e02e69a4a33477fe1a7816374f1
2022-02-12 10:24:32 -05:00
Aidan MacDonald
1ad60c3344 x1000-installer: remove redundant overflow check
This overflow is impossible to trigger due to the simple
relationship between binary and hexadecimal numbers.

Change-Id: Ie8243129967abb935a77152a808765318052c979
2021-11-28 15:46:06 +00:00
Aidan MacDonald
c086a3386f x1000-installer: map filenames accept only valid characters
Instead of using isgraph(), check for legal FAT32 characters
excluding spaces (which are used as field separators).

Change-Id: I291f0acb5f24c558099c237d913f4f35ae06b834
2021-11-28 15:46:06 +00:00
Aidan MacDonald
31242f8570 x1000-installer: add test for xf_map_parseline
Change-Id: I35db43c83dc3964607b95f6b5c300c2fef455ac8
2021-11-28 15:46:02 +00:00
Aidan MacDonald
4879891da3 x1000-installer: xf_stream_read_lines bugfixes
- Only treat EOF as newline if the line is non-empty to
  suppress a useless empty line after the end of a file.
- Deal with 0- and 1-byte line buffers safely.
- Remove whitespace stripping and comment handling which
  was left over from refactoring. Move it to xf_map_parse()
  where it belongs.

Change-Id: I9f05f4e18ca6dd011ca4cd231f0b5ea37c784778
2021-11-28 13:55:48 +00:00
Aidan MacDonald
420d545018 x1000-installer: tests for xf_stream.c
Change-Id: Ib9d1ca0109029f09ff0f8adfc10925c7c9a0f8b9
2021-11-28 13:55:43 +00:00
Aidan MacDonald
b027063c03 x1000-installer: simple test suite runner
Change-Id: I0b9ee81cbd8dda593924b2f7c32a1d1d87ce84b0
2021-11-28 13:45:20 +00:00
Aidan MacDonald
7ca8623927 x1000-installer: add test & code coverage support to makefile
Pass COVERAGE=1 to enable clang-based code coverage and pass
SANITIZE=1 to enable sanitizers. 'make cov' will run the test
app and show a coverage summary.

Change-Id: I8a33e8b78665165d8da1818dc01f495f0c52cf06
2021-11-28 13:45:20 +00:00
Aidan MacDonald
06423cab58 x1000-installer: Initial commit of new framework
This is a new flash installer framework for the X1000 targets.

A bunch of this code is *UNTESTED* but there is an external test
harness which allows the library to be built and tested on a PC.

Once tests are written and the bugs are ironed out this framework
will replace the existing installer code.

New features:

- Update tarballs are MD5-checksummed to guarantee integrity.
- The flash map is no longer fixed -- updates are self describing and
  carry a map file which specifies the areas to update.
- Can take full or partial backups with checksums computed on the fly.
- Supports an additional verification mode which reads back data after
  writing to ensure the flash contents were not silently corrupted.

Change-Id: I29a89190c7ff566019f6a844ad0571f01fb7192f
2021-11-27 15:28:19 -05:00