On Sat, Nov 14, 2020 at 07:25:36PM +0100, Bernd Walter wrote:
> I've tried to update for my board and saw that allocating the ethernet
> buffer failed.
> After activating more some debugging output, I've noticed that malloc
> fails even earlier.
> Don't think this is a RAM shortage, because it fails long before my main
> routine.
> My suspect is that there is a general heap problem.
> Memory debug is completely enabled.

up_allocate_heap() won't get called by nx_init, because MM_KERNEL_USRHEAP_INIT
isn't set.

There is a change in the code in nuttx/mm/mm.h

Previous:
#undef MM_KERNEL_USRHEAP_INIT
#if defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)
xxx
#  define MM_KERNEL_USRHEAP_INIT 1
#elif !defined(CONFIG_BUILD_KERNEL)
ddddd
#  define MM_KERNEL_USRHEAP_INIT 1
#endif

Now:
#undef MM_KERNEL_USRHEAP_INIT
#if !defined(CONFIG_BUILD_KERNEL) && defined(__KERNEL__)
xxx
#  define MM_KERNEL_USRHEAP_INIT 1
#endif

The Syntax errors are intentional to see which part gets
compiled.
The new code compiles fine, despite the error.
For the old code it complains about the ddddd, so this
is the part, which defined MM_KERNEL_USRHEAP_INIT for me
in the old code.

If I change it to the old logic, my board starts up fine.

> 
> BD
> mm_malloc: WARNING: Allocation failed, size 32
> mm_malloc: WARNING: Allocation failed, size 112
> mm_malloc: WARNING: Allocation failed, size 208
> mm_malloc: WARNING: Allocation failed, size 80
> mm_malloc: WARNING: Allocation failed, size 144
> mm_malloc: WARNING: Allocation failed, size 176
> mm_malloc: WARNING: Allocation failed, size 336
> mm_malloc: WARNING: Allocation failed, size 64
> mm_malloc: WARNING: Allocation failed, size 32
> mm_malloc: WARNING: Allocation failed, size 32
> mm_malloc: WARNING: Allocation failed, size 32
> mm_malloc: WARNING: Allocation failed, size 48
> sam_buffer_initialize: ERROR: Failed to allocate TX descriptors
> arm_netinitialize: ERROR: sam_buffer_initialize failed: -12
> mm_malloc: WARNING: Allocation failed, size 96
> mm_malloc: WARNING: Allocation failed, size 32
> mm_malloc: WARNING: Allocation failed, size 2336
> mm_malloc: WARNING: Allocation failed, size 32
> 
> -- 
> B.Walter <be...@bwct.de> http://www.bwct.de
> Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.

-- 
B.Walter <be...@bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.

Reply via email to