Issue with blocks in a partition

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue with blocks in a partition

Jump to solution
810 Views
admin
Specialist II

When using MQX 3.8 to create a partition with _partition_create_at, a few issues appear to be present:

  1. The number of blocks within the partition is incorrect.  There appears to be no way for the user to determine dynamically the number of bytes to allocate for the function to guarantee a certain number of blocks are available.
  2. The alignment of the blocks within a partition is lost due to additions by MQX.

Both of the issues appear to be the result of the following:

  1. The initial alignment of the partition (should be documented as required to not waste memory)
  2. The PARTPOOL_STRUCT assigned to the beginning of the partition stealing from memory for blocks (the user has no method of determine the size of the structure to add it to the initial declaration of memory in the application)
  3. The INTERNAL_PARTITION_BLOCK_STRUCT appears to be added to beginning of every block within the partition (again, the size is not available)
  4. The alignment of the blocks within the partition due to adding a structure at the beginning of each block

Here are a couple questions that the documentation doesn't clarify:

  • If 10 blocks of 256 bytes are required, how does the user make the memory declaration?
  • Can the user aligned each block on a 256 byte boundary by aligning the declaration on a 256 byte boundary?

The only example I could find within MQX was in mqx\examples\benchmrk\timing\test.c which uses magic numbers when calling the function.

0 Kudos
Reply
1 Solution
518 Views
admin
Specialist II

Here is the response from Freescale Support:

------------------------------------------------------------

In reply to your message regarding Service Request SR 1-852766775:

 

I just received the answer from the dev team. Please take a look:

 

====================================
The customer is correct. The partitions use some helper structures for each block and also at the beginning of the partition area. And he is correct the structures are internal so he cannot do the calculation himself.

 

We will not solve the root cause, but we can add API to make the calculations for the user. I would see two API functions are needed:

 

-partition_at_calc_size(block_size, block_count) ... will calculate how much memory is needed for given number of blocks

 

-partition_at_calc_blocks(block_size, memory_size) ... will calculate how many blocks will fit into given memory area

 

I’m afraid there is no solution for the block alignment requirement. 
====================================

 

The ticket with the dev team was just opened for the creation of the new API. We will have to wait until next release to see the API added. Could you please wait until the next release is done (estimated to the end of 2012Q2)?

 

Have a nice day!

 

Should you need to contact us with regard to this message, please see the notes below.

 

Best Regards,
Luis
Technical Information & Commercial Support

Freescale Semiconductor

------------------------------------------------------------


Now these two functions will not make for a very graceful solution to issue #1, but it will suffice if that is all that is available.  The main issue I see is that the SW will have to be executed and the returns of the new functions checked for the memory map used to be certain that the number of blocks within a partition is as expected.

 

As far as the alignment is concerned, this creates an issue that limits use of the partition system for certain applications and optimization techniques.  A cumbersome and overly complex workaround would be to use the partition system to just contain pointers to aligned memory blocks that the user would have to initialize and then use via pointers to pointers.

View solution in original post

0 Kudos
Reply
1 Reply
519 Views
admin
Specialist II

Here is the response from Freescale Support:

------------------------------------------------------------

In reply to your message regarding Service Request SR 1-852766775:

 

I just received the answer from the dev team. Please take a look:

 

====================================
The customer is correct. The partitions use some helper structures for each block and also at the beginning of the partition area. And he is correct the structures are internal so he cannot do the calculation himself.

 

We will not solve the root cause, but we can add API to make the calculations for the user. I would see two API functions are needed:

 

-partition_at_calc_size(block_size, block_count) ... will calculate how much memory is needed for given number of blocks

 

-partition_at_calc_blocks(block_size, memory_size) ... will calculate how many blocks will fit into given memory area

 

I’m afraid there is no solution for the block alignment requirement. 
====================================

 

The ticket with the dev team was just opened for the creation of the new API. We will have to wait until next release to see the API added. Could you please wait until the next release is done (estimated to the end of 2012Q2)?

 

Have a nice day!

 

Should you need to contact us with regard to this message, please see the notes below.

 

Best Regards,
Luis
Technical Information & Commercial Support

Freescale Semiconductor

------------------------------------------------------------


Now these two functions will not make for a very graceful solution to issue #1, but it will suffice if that is all that is available.  The main issue I see is that the SW will have to be executed and the returns of the new functions checked for the memory map used to be certain that the number of blocks within a partition is as expected.

 

As far as the alignment is concerned, this creates an issue that limits use of the partition system for certain applications and optimization techniques.  A cumbersome and overly complex workaround would be to use the partition system to just contain pointers to aligned memory blocks that the user would have to initialize and then use via pointers to pointers.

0 Kudos
Reply