Skip to content

Fix hi3516av200 malloc size for cold NAND boot + UBI write - #8

Merged
widgetii merged 1 commit into
masterfrom
fix/ubi-write-after-tftp
Apr 22, 2026
Merged

Fix hi3516av200 malloc size for cold NAND boot + UBI write#8
widgetii merged 1 commit into
masterfrom
fix/ubi-write-after-tftp

Conversation

@widgetii

Copy link
Copy Markdown
Member

Summary

Root cause

hi3516av200.h defines CONFIG_SYS_MALLOC_LEN = CONFIG_ENV_SIZE + N, then #includes hi-common.h which redefines CONFIG_ENV_SIZE from 0x40000 to 0x10000. Since C macros are expanded at point of use (not definition), the effective heap was always smaller than intended.

Test plan

  • Cold NAND boot — System startup → Uncompress...Ok → U-Boot 2010.06 in 2.5s
  • Full defib restore with all 7 MTD partitions — all UBI writes succeed after TFTP, zero errors
  • Both tests on real hi3516av200 hardware with MX35LF1GE4AB SPI NAND

Closes #7

🤖 Generated with Claude Code

The previous fix used CONFIG_ENV_SIZE in the malloc definition, but
hi-common.h redefines CONFIG_ENV_SIZE from 0x40000 to 0x10000 after
hi3516av200.h, silently shrinking the heap from 768KB to 576KB.

Use a literal 0x40000 + 768KB = 1MB total heap. This value:
- Fits UBI's 124KB vmalloc after TFTP (issue #5)
- Stays within SPL MMU page table limits for cold NAND boot (issue #7)

Tested on hardware: cold NAND boot OK, full 7-partition UBI restore OK.

Closes #7

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii
widgetii force-pushed the fix/ubi-write-after-tftp branch from d964e29 to c547251 Compare April 22, 2026 14:48
@widgetii
widgetii merged commit 91d9d69 into master Apr 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hi3516av200: U-Boot hangs on cold NAND boot — SPL DDR training fails

2 participants