STM32F4 & IAR

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
yosoufe
Posts: 9
Joined: Thu Jan 26, 2017 1:34 pm
Has thanked: 1 time

STM32F4 & IAR

Post by yosoufe »

Hi

I am trying to run the chibios on stm32f4-Discovery board with IAR! In the version that I have downloaded from the sourceforge there is no demo example for IAR and STM32F4. I have tried to use the STM32F3 demo. The blinking demo is working but I've got this warning during the debug session. This warning does not appear during the compilation:

Code: Select all

Tue Jan 31, 2017 17:40:50: The stack pointer for stack 'CSTACK' (currently 0x20000400) is outside the stack range (0x2001F000 to 0x20020000) 


How much dangerous is it? I am wondering if the code becomes bigger, would it cause problems? Can you introduce me some easy tutorials about writing the icf file and specially icf for the chibiOS.

Thanks
Yousof
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F4 & IAR

Post by Giovanni »

Hi,

That warning is normal, that debugger assumes one execution thread and one stack, using an RTOS there are multiple stacks and the debugger thinks it overflowed, nothing to worry about. Not sure about why it assumes the stack to be in that range.

About the ICF, it is better if you take the one provided with the F3 demo and just adjust memory areas for the F4.

Giovanni
yosoufe
Posts: 9
Joined: Thu Jan 26, 2017 1:34 pm
Has thanked: 1 time

Re: STM32F4 & IAR

Post by yosoufe »

Thanks a lot
Sorry. I am not at all profi in this area. I may ask silly questions.

this is the memory map of the stm32f407 on the discovery board from its datasheet
Image

and the following is the icf file that I may use

Code: Select all

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
define symbol __ICFEDIT_region_ROM_end__   = 0x0801FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__   = 0x2001FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x2000;
define symbol __ICFEDIT_size_heap__   = 0x2000;
/**** End of ICF editor section. ###ICF###*/

/* Size of the IRQ Stack (Main Stack).*/
define symbol __ICFEDIT_size_irqstack__   = 0x400;

define memory mem with size = 4G;
define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   {section CSTACK};
define block IRQSTACK  with alignment = 8, size = __ICFEDIT_size_irqstack__ {};
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     {};
define block SYSHEAP   with alignment = 8                                   {section SYSHEAP};
define block DATABSS with alignment = 8 {readwrite, zeroinit};

initialize by copy { readwrite };
do not initialize  { section .noinit };

keep { section .intvec };

place at address mem:__ICFEDIT_intvec_start__ {section .intvec};
place in ROM_region                           {readonly};
place at start of RAM_region                  {block IRQSTACK};
place in RAM_region                           {block DATABSS, block HEAP};
place in RAM_region                           {block SYSHEAP};
place at end of RAM_region                    {block CSTACK};


where should I fit the system memory in the table above in my icf file? is the file correct? I feel the system memory is missing in the icf file now! because I can guess the flash area is ROM and the SRAM areas are RAM in Chibios icf file. but nothing corresponds to system memory or CCRAM_region (called by icf default file from IAR)
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F4 & IAR

Post by Giovanni »

Hi,

Sorry, I don't understand the problem.

Just take the Flash and RAM ranges you want to use and put them in the "Memory Regions" section of the ICF file.

Giovanni
yosoufe
Posts: 9
Joined: Thu Jan 26, 2017 1:34 pm
Has thanked: 1 time

Re: STM32F4 & IAR

Post by yosoufe »

Giovanni wrote:Hi,

Sorry, I don't understand the problem.

Just take the Flash and RAM ranges you want to use and put them in the "Memory Regions" section of the ICF file.

Giovanni


In the ICF file, why don't I need to define an area corresponding to system memory?
Post Reply