Thu 18 Feb 2016 08:19:19 PM UTC, comment #6:
> David, you're not the first wanting to put the pools into a different section. So far, everyone seems to have succeeded with what we provide (unless the recent memp changes have broken this).
Sure, I can manage as is... that is what I'm doing, but seems ugly enough to suggest a standard way to do it in line with other lwIP features like the packing and the like.
> Being like that, I'm reluctant to add a 2nd method to do the same thing.
The "first" method does not work with standard pools... You can't define the macro for them.
>> I need to be able to apply the attributes to existing standard pools, that are considered private...
> Could you please provide an example of which pool you try to move? I think we need to have an example instead of staying too general in this discussion.
All the ones defined in src/include/lwip/priv/memp_std.h:
Which src/include/lwip/memp.h declares (for no MEMP_MEM_MALLOC) as:
#else /* MEMP_MEM_MALLOC */
#define LWIP_MEMPOOL_DECLARE(name,num,size,desc) u8_t memp_memory_ ## name ## _base \
[((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))]; \
\
static struct memp *memp_tab_ ## name; \
\
const struct memp_desc memp_ ## name = { \
LWIP_MEM_ALIGN_SIZE(size), \
(num), \
DECLARE_LWIP_MEMPOOL_DESC(desc) \
memp_memory_ ## name ## _base, \
&memp_tab_ ## name \
};
Note that the declaration of the pool memory is the first line:
u8_t memp_memory_ ## name ## _base \
[((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))]; \
Which does not allow for any attribute or the like, and cannot be circunvented inside src/core/memp.c unless we inject an include file with the right extern declaration to all lwip files when building, as I show at the end of the original submission message.
Sure it can be made to work, but a standard way would be better... If you see it as a good thing, of course.
>> Similarly for ram_heap
> Using GCC, add this line to your lwipopts.h:
> extern unsigned char attribute((section(".onchip_mem"))) ram_heap[];
Sure, it is what I'm doing at the moment, but again, I respectfully suggest that having a standard way through configuration options would be better.
Anyway, do it as you see fit. Just let me know if anything is still not clear.
|