As there're linker-defined symbols like
Load$$LR$$load_region_name$$Base Address of the load region. Load$$LR$$load_region_name$$Length Length of the load region. Load$$LR$$load_region_name$$Limit Address of the byte beyond the end of the load region
to get the attributes of a Load region. But I think the Load$$LR$$load_region_name$$Length and Load$$LR$$load_region_name$$Limit are redundant. Since we can calculate the Limit address by adding the Length to the Base address.
My question is how to get the maximum size of a region in C source? For example,
Load Region LR_IROM1 (Base: 0x00005000, Size: 0x00005cb8, Max: 0x0000b000, ABSOLUTE, COMPRESSED[0x000054ec])
Load$$LR$$LR_IROM1$$Length would be 0x000054ec. But is there any symbol to refer to the value of 0x0000b000?
I am looking for answer too. I need to know REGION MAX value which we specify in Scatter file.
ER_IROM1 0x00000000 <REGIONMAX_VALUE> { }
I am looking for answer too. So how to get it?
So why don't the Length and/or Limit symbols answer your question?
the Length and/or Limit symbols are only the region value you have used or your code has occupied , but not the maxsize
Maybe we can define a useless region as below
ER_IROM1 0x00000000 0x100 {
}
ER_USELESS 0x00000100 {
and in c file, we can use (ER_USELESS - ER_IROM1 )to get the maxsize which is 0x100, but I haven't verified it yet.
any update on this? This is exactly what I am looking for.
Hi rkopsch could you help with this question at all? Many thanks.
The Linker User Guide introduces i.e the "execution region attribute ANY_SIZE max_size to specify the maximum size in a region that armlink can fill with unassigned sections":
https://www.keil.com/support/man/docs/armlink/armlink_pge1362065995619.htm
as part of
https://www.keil.com/support/man/docs/armlink/armlink_pge1362065968963.htm
Related:
"ARMLINK: L6220E ... Exceeds Limit, If Placing Data at End of Flash"
developer.arm.com/.../latest
thank you, but how do I access the 'max_size' in code? I am not interrested in changing scatter files or changing the max size at all. I want to known what it is, in code.
A bit more context: Our framework needs a buffer as large as possible. This is shared over all products we have. But the max size needs to be configured every time for each new project and each target. We want to use all the ram available by using the unused spaced between the end of the stack region and the physical end of the ram. This is why I need to known at which address the application stops using ram and the actual max available ram.
The end of the used ram by the application I can find, that is not the problem. But how do I get the max available ram? That is, the size of the ram as configured in uVision. This is the max_size of the region. I can find the value manually in the map file. But I need it in code.
thank you.
I see - I will discuss this request in our Support Team and we'll get back to you afterwards, Martijn.
Btw - with a valid license key in use, you are entitled to create a corresponding Support Ticket:
https://www2.keil.com/support/silver?P=&V=&S=
There is no linker defined symbol for getting the maximum possible size of a region that is configured in the scatter file.
But, if you need to share such information between your application and the linker configuration, you can use the scatter file preprocessing feature (here is the related documentation in the Arm Compiler 6 toolchain documentation):
https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_pge1362066010024.htm
So you can use a macro #define in a header file, that you can include in your application and the scatter file to have this setting centralized in one place only.
using a define per device was exactly what we were trying to prevent. I was also thinking, is it possible to set the stack to the end of the ram by default, instead of right after the heap? That way we can determine the unused space in front of the stack.