A "simple" question.
I'm using bootloader example
I want to write some functions in "bootloader" and some other in "program" , but is there a method to tell one function is in s specific flash area or did I have to use "org" for each one (so looking the binary code to see emply areas) ?
I tried following code and it seem working but perhaps not a good solution. "x1=0" so "Fct_boot" will not called but is included in boot area (if I write "if(0)Fct_boot;" the compiler will not write Fct_boot in flash)#define BOOTLOADER_START_ADDR 0xC0
#define START_PROGRAM_ADDR 0x1800
#define FLASH_SIZE_STM32F051K6U6 16000
//------------------------------------------------------------------------------
void Fct_boot()
{
}
//------------------------------------------------------------------------------
void Fct_Program()
{
}
//------------------------------------------------------------------------------
void Start_Program() org START_PROGRAM_ADDR
{
SetInterrupts();
Soft_I2C_Init();
delay_ms(10);
while(1)
{
Led_Green_Reverse
delay_ms(500);
}
}
//------------------------------------------------------------------------------
void main() org BOOTLOADER_START_ADDR
{
// Main program
SetIOs();
Led_Red
UART1_Init(9600);
Delay_100ms();
if (UART1_Write_Loop('g','r'))
{
Start_Bootload();
}
else
{
Start_Program();
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void main() org BOOTLOADER_START_ADDR
{
char x1=0;
SetIOs();
Led_Red
UART1_Init(9600);
Delay_100ms();
if(x1)Fct_boot;
if (0) //UART1_Write_Loop('g','r'))
{
Start_Bootload();
}
else
{
Start_Program();
}
}