shared memory with threadx

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

Reply to
mungam
Loading thread data ...

"mungam" wrote

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

Reply to
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

Reply to
mungam

"mungam" wrote in

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

Reply to
Stan Katz

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

Reply to
mungam

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

Reply to
mungam

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.