You are browsing as a guest. Sign up (or log in) to start making projects!

41m 20s logged

BIN Loading and Memory Map

Implemented raw .bin loading:

  • opens files in binary mode
  • maps bytes at --base
  • stores the image as one source chunk
  • handles empty files
  • rejects address overflow
  • reports file errors with diagnostics

Extended BlFirmwareImage with owned analysis data:

  • reconstructed regions
  • gaps
  • overlaps

Implemented bl_memmap_reconstruct:

  • sorts source chunks by address
  • merges adjacent chunks
  • merges overlapping chunks while preserving first-seen bytes
  • records sparse gaps
  • records overlaps as identical or conflicting

CLI output now includes:

  • input metadata
  • source chunks with -v
  • memory regions
  • gaps
  • overlaps

Added tests:

  • test_bin_loader.c
  • test_memmap.c

Covered base-address mapping, overflow rejection, adjacent merge, sparse gaps, identical overlaps, and conflicting overlaps.

Entropy and Cortex-M Analysis

Implemented Shannon entropy without requiring -lm, keeping the Makefile dependency-free.

Entropy is now reported:

  • per reconstructed region
  • per fixed-size chunk in verbose mode
  • as an ASCII heatmap with --heatmap

--entropy-chunk controls the chunk size.

Implemented Cortex-M vector table detection:

  • checks common aliases like 0x00000000 and 0x08000000
  • reads initial SP and reset handler as little-endian words
  • validates SRAM stack range
  • validates stack alignment
  • validates Thumb reset bit
  • checks whether reset target lands in loaded firmware
  • reports confidence score: none, low, medium, high

Added STM32-like fixture:

  • tests/fixtures/stm32_vector.ihex

Added tests:

  • test_entropy.c
  • test_vector_table.c

Covered known entropy values, heatmap symbols, high-confidence vector detection, missing-vector behavior, and an end-to-end STM32-like HEX sample.

Verification

Native GCC build passed with:

-std=c11 -Wall -Wextra -Wpedantic

Tests passed:

test_bin_loader: ok
test_entropy: ok
test_hex_parser: ok
test_memmap: ok
test_smoke: ok
test_vector_table: ok

Docker POSIX path passed:

make clean
make test
make

Current State

The MVP analysis path is now feature-complete for:

  • Intel HEX parsing
  • raw BIN loading
  • memory layout reconstruction
  • gap and overlap reporting
  • per-region entropy
  • chunk entropy
  • ASCII heatmap
  • Cortex-M vector table detection

Remaining stretch work includes JSON output, richer heuristics, section guessing, and comparison mode.

0
0

Comments 0

No comments yet. Be the first!