electroRF
Member
Hi,
In my uC, I got 3 virtual memory banks.
Every time me and my colleagues add code or data to the project, we must map each code/data to a certain memory bank (we of course sometimes remove data/code to spare in memory).
Every few days, we combine all our additions / changes / removals, and we sometimes fail at linker stage since one (or more) of the memory banks cannot contain the entire code and/or data that were added.
I'd like to write a script which will see how much a certain memory bank is overfilled, and edit the mapping done in the source files so some code / data will be transferred to an available memory bank.
the main challenge is that the code / data are united into different groups.
So that actually the script will move groups.
That is a challenge because it'd make it harder for the script to find the exact amount of data/code it needs to transfer from an overfilled memory bank to an available memory bank.
Given to the script are:
- how much space is available in each memory bank (or how much a memory bank is overfilled), and their total size
- Size of each function / variable and where it's mapped
My goal is to:
- Move code / data from the overfilled Memory Bank(s) to the available Memory Banks in a way that they would be somewhat balanced.
For example, given to the script:
Bank A, size of 1MB, overfilled with 300KB
Bank B, size of 2MB, has an available 250KB
Bank C, size of 3MB, has an available 400KB
I'd ideally like to move 300KB from Bank A to Bank B and 100KB from Bank A to Bank B, in order to get a balanced result:
script's output:
Bank A --> Available 100KB
Bank B --> Available 150KB
Bank C --> Available 100KB
I'd love to hear guidelines or tips from you how to accomplish a balanced memory.
Thank you.
***
Currently, the Algorithm which I thought of is:
1. Find the Memory Bank which is overfilled
2. Find the Memory Bank which has the highest available amount of Memory
3. Balance these two Memory Banks equally (as possible)
4. Go back to 1) in case there was more than one bank which failed, and repeat the process.
In the case of the example I brought, it'd move 350KB from Bank A to Bank C, which would give a not-so-balanced memory result:
Bank A --> Available 50KB
Bank B --> Available 250KB
Bank C --> Available 50KB
In my uC, I got 3 virtual memory banks.
Every time me and my colleagues add code or data to the project, we must map each code/data to a certain memory bank (we of course sometimes remove data/code to spare in memory).
Every few days, we combine all our additions / changes / removals, and we sometimes fail at linker stage since one (or more) of the memory banks cannot contain the entire code and/or data that were added.
I'd like to write a script which will see how much a certain memory bank is overfilled, and edit the mapping done in the source files so some code / data will be transferred to an available memory bank.
the main challenge is that the code / data are united into different groups.
So that actually the script will move groups.
That is a challenge because it'd make it harder for the script to find the exact amount of data/code it needs to transfer from an overfilled memory bank to an available memory bank.
Given to the script are:
- how much space is available in each memory bank (or how much a memory bank is overfilled), and their total size
- Size of each function / variable and where it's mapped
My goal is to:
- Move code / data from the overfilled Memory Bank(s) to the available Memory Banks in a way that they would be somewhat balanced.
For example, given to the script:
Bank A, size of 1MB, overfilled with 300KB
Bank B, size of 2MB, has an available 250KB
Bank C, size of 3MB, has an available 400KB
I'd ideally like to move 300KB from Bank A to Bank B and 100KB from Bank A to Bank B, in order to get a balanced result:
script's output:
Bank A --> Available 100KB
Bank B --> Available 150KB
Bank C --> Available 100KB
I'd love to hear guidelines or tips from you how to accomplish a balanced memory.
Thank you.
***
Currently, the Algorithm which I thought of is:
1. Find the Memory Bank which is overfilled
2. Find the Memory Bank which has the highest available amount of Memory
3. Balance these two Memory Banks equally (as possible)
4. Go back to 1) in case there was more than one bank which failed, and repeat the process.
In the case of the example I brought, it'd move 350KB from Bank A to Bank C, which would give a not-so-balanced memory result:
Bank A --> Available 50KB
Bank B --> Available 250KB
Bank C --> Available 50KB
Last edited: