EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

shared memory with threadx

Started by mungam April 25, 2006
hello,

Im  working on threadx rtos (actually with NET+OS 6.3 from Netsilicon),
I have already the source code of my project but I need to port it to
threadx. This code uses shared memory with such libraries and functions
as shm.h or  shm_open() which are not provided by threadx.
How can I do the same thing? Everything would be ok if it wouldn't miss
memory.h and sys/shm.h.... :(

help...

THX

"mungam" wrote
> > Im working on threadx rtos (actually with NET+OS 6.3 from Netsilicon), > I have already the source code of my project but I need to port it to > threadx. This code uses shared memory with such libraries and functions > as shm.h or shm_open() which are not provided by threadx. > How can I do the same thing? Everything would be ok if it wouldn't miss > memory.h and sys/shm.h.... :( >
Threadx doesn't enforce separate memory spaces for each thread, so memory is global by default. I have one application that does use the mmu to enforce separate memory spaces with ThreadX but that has a much slower context switch and it is not the standard way of operating. You can use the standard Threadx memory allocation functions to get memory that can be used as shared. Stan Katz
Where can I found those standards memory allocation functions?
do you speak about:
tx_block_pool_create
tx_block_allocate
Does it exist the equivalent of functions as shm_open or mmap?

THx for help Stan

"mungam" <adrien.bureau@gmail.com> wrote in
> Where can I found those standards memory allocation functions? > do you speak about: > tx_block_pool_create > tx_block_allocate > Does it exist the equivalent of functions as shm_open or mmap? > > THx for help Stan >
Yes, you can use either these or the tx_byte_allocate set of functions if you don't want to work in fixed size blocks and your application won't run into fragmentation issues. They work more on the level or malloc than file/stream I/O so the implememtation of the mmap interface should be simple. You can probably write yourself a version of shm_open that uses the threadx calls so you don't have to change your code, but since threadx doesn't really handle file I/O you will need to do your own stream read/write/seek/etc. Stan
thx for your explanation Stan
but I fell it hard to rewrite my own shm_opoen etc...
do you know where I could find that?
It's a pity it's is not provided

Thx

thx for your explanation Stan
but I fell it hard to rewrite my own shm_opoen etc...
do you know where I could find that?
It's a pity it's is not provided

Thx


The 2024 Embedded Online Conference