can i share a variable between custom bootloader and user application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-08 6:51 AM
Hi
I have a custom bootloader that I flash to the first sector (0x8000000) and when it receives a new program it loads it to 0x8003000. I can jumps to the user application,and also
jumps
from user application to the bootloader.I
want to know if there
are any methods to tell the custom boot
loader
, there are not a simple start-up, but it's a jump from user application.
can i share a variable between bootloader and user application?
Thank you in advance !
#custom-bootloader #stm32f1- Labels:
-
Bootloader
-
STM32F1 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-08 7:33 AM
You'd need to carve out an area of RAM, which you app doesn't clear, where you can place variables or a structure, to communicate data between them
typedef struct _FOO {
int a;
int b;
} FOO;
FOO *foo = (FOO *)0x2000FF00; // some upper RAM area for your part, pick something appropriate
foo->a = 1234;
foo->b = 4321;
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-08 9:05 AM
should i do that in my custom bootloader?
typedef struct _FOO {
int a;
int b;
} FOO;
FOO *foo = (FOO *)0x2000FF00;
if (foo->a == 1234) // thats mean i was in application
{
//do ......
}
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-08 9:11 AM
The CPU doesn't inherently clear RAM over a reset, so the technique is viable either way. The example assumes your part has 64KB of SRAM, and you hide 256 bytes from the linker so you can pass parameters. This could be a command line, or whatever.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-08 10:14 AM
How can i choose the adresse
0x2000FF00, should be before the bootloader or in application memory?
thnak's
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-08 11:18 AM
It will depend on the specific part you are using. The boot loader and application share the same RAM resources, the linker settings typically assume they can use all available memory.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-03-09 4:05 AM
I chosed 0x200001DC as an adresse for FOO, but when i jump from user application to bootloader 'foo->a' and 'foo->b' equals zero, so foo->x change when i jump. any suggestion
thank's
