You may just increase the stack size for IRQs. IRQ stack overflows are the harder to detect because all planets have to align perfectly...
Note that in ChibiOS the IRQ stack is placed at beginning of RAM, any overflow should trigger a bus error.
Giovanni
HardFaultVector, INVSTATE?
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: HardFaultVector, INVSTATE?
My current values are
I've just re-read http://www.chibios.org/dokuwiki/doku.ph ... :kb:stacks but I have to admit I am not sure which one is related to IRQs. I was under an impression that IRQs go into PORT_INT_REQUIRED_STACK stack which is part of WORKING_AREA for each thread, is that right?
Code: Select all
#define PORT_IDLE_THREAD_STACK_SIZE 1024
#define PORT_INT_REQUIRED_STACK 768
__main_stack_size__ = 0x0600;
__process_stack_size__ = 0x0600;I've just re-read http://www.chibios.org/dokuwiki/doku.ph ... :kb:stacks but I have to admit I am not sure which one is related to IRQs. I was under an impression that IRQs go into PORT_INT_REQUIRED_STACK stack which is part of WORKING_AREA for each thread, is that right?
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: HardFaultVector, INVSTATE?
The IRQ stack is __main_stack_size__, the "main" stack, ARM name for it...
The process stack is the stack for main().
Clear, isn't it?
PORT_INT_REQUIRED_STACK is the amount of RAM to be reserved in all threads for IRQ servicing and usually should not be changed.
Giovanni
The process stack is the stack for main().
Clear, isn't it?
PORT_INT_REQUIRED_STACK is the amount of RAM to be reserved in all threads for IRQ servicing and usually should not be changed.
Giovanni
Re: HardFaultVector, INVSTATE?
I am well aware that I am not the sharpest pencil in the box. As a matter of fact, no - it was not clear enough for me - until 10 seconds ago I did not get it.
Sounds like __main_stack_size__ is where IRQs stack lives, while PORT_INT_REQUIRED_STACK is the amount of RAM to be reserved in all threads for IRQ servicing prior to going into __main_stack_size__ and usually should not be changed?
It was not clear for me that IRQ would first take a bit of thread stack and then do the rest in it's own stack. Thank you for your patience to clarify this, now I see that my fault was to increase PORT_INT_REQUIRED_STACK and not __main_stack_size__. It might be helpful to mention that in the comment, but on the other hand this case you might end up with the whole ARM datasheet in your comments.
Sounds like __main_stack_size__ is where IRQs stack lives, while PORT_INT_REQUIRED_STACK is the amount of RAM to be reserved in all threads for IRQ servicing prior to going into __main_stack_size__ and usually should not be changed?
It was not clear for me that IRQ would first take a bit of thread stack and then do the rest in it's own stack. Thank you for your patience to clarify this, now I see that my fault was to increase PORT_INT_REQUIRED_STACK and not __main_stack_size__. It might be helpful to mention that in the comment, but on the other hand this case you might end up with the whole ARM datasheet in your comments.
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: HardFaultVector, INVSTATE?
I think you misunderstood my post or it was just poorly written, mine was an attempt at sarcasm because the confusing names chosen by ARM for the stacks, certainly not directed to you. It cannot be clear because the names are the exact opposite of their meaning.
You got perfectly the technical part, some space is still required in the thread stack for interrupts servicing, that space is represented by PORT_INT_REQUIRED_STACK and the structure extctx.
Giovanni
You got perfectly the technical part, some space is still required in the thread stack for interrupts servicing, that space is represented by PORT_INT_REQUIRED_STACK and the structure extctx.
Giovanni