tasklwIP - A Lightweight TCP/IP stack - Tasks: task #10139, Prefer statically allocated memory

 
 

You are not allowed to post comments on this tracker with your current authentication level.

task #10139: Prefer statically allocated memory

Submitter:  Simon Goldschmidt <goldsimon>
Submitted:  Mon 01 Feb 2010 08:27:50 PM UTC
   
 
Category:  None Should Start On:  Mon 01 Feb 2010 12:00:00 AM UTC
Should be Finished on:  Mon 01 Feb 2010 12:00:00 AM UTC Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  goldsimon Percent Complete:  100%
Open/Closed:  Closed Planned Release:  1.4.0
Effort:  0.00

Fri 12 Feb 2010 04:43:18 PM UTC, comment #3: 

Added autoip_set_struct() and dhcp_set_struct() to let autoip and dhcp work with user-allocated structs instead of calling mem_malloc.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 12 Feb 2010 02:01:43 PM UTC, comment #2: 

Changed the sem- and mbox-functions together with adding mutexes in sys.h (task #10139), adapted win32- and unix-port.

Remainin: dhcp_start/autoip_start should take an allocated struct instead of calling mem_malloc.

Simon Goldschmidt <goldsimon>
Group administrator
Tue 09 Feb 2010 09:55:12 PM UTC, comment #1: 

This is the last call for objections before I change semaphore and mbox functions to take pointers and the _new() functions returning err_t instead of sys_sem/mbox_t:

err_t sys_sem_new(sys_sem_t *sem, u8_t count);
void sys_sem_signal(sys_sem_t *sem);
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout);
void sys_sem_free(sys_sem_t *sem);

err_t sys_mbox_new(sys_mbox_t *mbox, int size);
void sys_mbox_post(sys_mbox_t *mbox, void *msg);
err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg);
u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void *msg, u32_t timeout);

This essentially allows allocating semaphores/mboxes statically or even on the stack. It breaks ports but is much more targeted on embedded OSes than the current implementation.

And if I'm not mistaken, this idea is supported by one (more or less) active developer (besides me) already (see https://savannah.nongnu.org/task/?7212#comment4).

I'll do the change this week (hopefully some tim tomorrow) if noone objects.

Simon Goldschmidt <goldsimon>
Group administrator
Mon 01 Feb 2010 08:27:50 PM UTC, original submission:  

I'd like to use statically allocated memory in various places throughout the stack instead of dynamically allocating:

- dhcp_start/autoip_start: take a corresponding struct pointer as argument to prevent mem_malloc (this leaves it open to use mem_malloc to the caller)
- semaphores/mboxes: take a pointer as argument for creating the sem/mbox instead of returning it. This way, defining sys_sem_t/sys_mbox_t appropriately, both allocating the sem/mbox dynamically and statically could be achieved (see Jifl's comment in another thread: https://savannah.nongnu.org/task/?7212#comment4 - by now, I prefer that over the old functions :)

There might be other places where changes into this direction might fit, but I think it's a generic question of which approach we want lwIP to take, which is why I'm posting this here.

Any comments are welcome!

Simon Goldschmidt <goldsimon>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-02-12 goldsimon StatusIn Progress Done
        Percent Complete70% 100%
        Open/ClosedOpen Closed
    2010-02-12 goldsimon Planned ReleaseNone 1.4.0
    2010-02-12 goldsimon StatusNone In Progress
        Percent Complete0% 70%
        Assigned toNone goldsimon

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code