...access memory segments from within a program
How can I determine the start and end addresses of a memory segment from within a program?
The CrossWorks for ARM linker script generator creates __segment_name_segment_start__ and __segment_name_segment_end__ symbols to mark the start and end of each segment.
As an example, if you want to set a pointer to the start address of the FLASH segment you could use the following code:
extern unsigned char __FLASH_segment_start__;
void
func(void)
{
unsigned char *ptr = &__FLASH_segment_start__;
...
}
Please sign in to leave a comment.
Comments
1 comment