Hi,
You can set any value, it is rounded to a multiple of 8 internally. Enable stack checking and MPU guard pages in port layer, this way you will get clear halts for overflows, also verify the exceptions stack, the size is in the makefile, the default is very generous.
Giovanni
VESC, and B-G431B-ESC1 and stm32g4xx development progress...
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
Just add -DPORT_ENABLE_GUARD_PAGES=1 to your makefile and enable stack checks in chconf.h.
It uses MPU for stack overflow detection, much more reliable than the normal SW stack check.
Giovanni
It uses MPU for stack overflow detection, much more reliable than the normal SW stack check.
Giovanni
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
Ok, thanks but PORT_USE_MPU_REGION need to be defined.
Code: Select all
ChibiOS/os/common/ports/ARMCMx/chcore_v7m.c:278:24: error: 'PORT_USE_MPU_REGION' undeclared (first use in this function)
mpuConfigureRegion(PORT_USE_MPU_REGION,
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
That looks like a bug... you are using trunk code right?
Giovanni
Giovanni
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
Yes, I am using trunk from last month.
Even without MPU, I was able to reduce RAM usage to 15 kB!
But the stack checker did not help me, do I need to enable another option to use it?
As I understand, a stack overflow should be detected and the OS halted? Instead, the application was just working with some errors.
So I have stopped reducing the stacks size when the application stopped working normally.
With NIL, I was able to reduce RAM by about 6 kB and FLASH 7 kB.
So there is some hope but a lot of changes are needed from stock VESC firmware to disable most features that are not just BLDC and FOC.
For now, the issue is on FLASH side, my minimal version is still using 150 kB and the G431 has only 128 kB. But should be doable.
While trying to build with NIL, I noticed that NIL cannot be built with semaphores support disabled (not so surprising because what is the point to use an RTOS without any lock mechanism, but maybe the option to disable semaphores should be removed?).
And the time_msecs_t typedef is missing in NIL's ch.h, preventing the use of TIME_I2MS.
Even without MPU, I was able to reduce RAM usage to 15 kB!
But the stack checker did not help me, do I need to enable another option to use it?
As I understand, a stack overflow should be detected and the OS halted? Instead, the application was just working with some errors.
So I have stopped reducing the stacks size when the application stopped working normally.
With NIL, I was able to reduce RAM by about 6 kB and FLASH 7 kB.
So there is some hope but a lot of changes are needed from stock VESC firmware to disable most features that are not just BLDC and FOC.
For now, the issue is on FLASH side, my minimal version is still using 150 kB and the G431 has only 128 kB. But should be doable.
While trying to build with NIL, I noticed that NIL cannot be built with semaphores support disabled (not so surprising because what is the point to use an RTOS without any lock mechanism, but maybe the option to disable semaphores should be removed?).
And the time_msecs_t typedef is missing in NIL's ch.h, preventing the use of TIME_I2MS.
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
You need to enable both the stack check in chconf.h and those MPU-related options. It places a non-accessible page below stack areas so it is strange it is not detecting anything.
I will look into those issues in NIL, it is a new version not yet released.
Giovanni
I will look into those issues in NIL, it is a new version not yet released.
Giovanni
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
Fixed the problem with the MPU option, about NIL, it does build with semaphores disable but you need to disable all those modules that depends on semaphores too, there are #error catching this.
Giovanni
Giovanni
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
Ok, great for MPU, I will make sure to test it soon!
NIL without semaphores and CH_CFG_ST_TIMEDELTA not 0 does not build:
NIL without semaphores and CH_CFG_ST_TIMEDELTA not 0 does not build:
Code: Select all
ChibiOS/os/nil/src/ch.c: In function 'chSysTimerHandlerI':
ChibiOS/os/nil/src/ch.c:373:17: error: 'union <anonymous>' has no member named 'semp'
tp->u1.semp->cnt++;
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: VESC, and B-G431B-ESC1 and stm32g4xx development progress...
Fixed, it was for CH_CFG_ST_TIMEDELTA equal to zero.
Giovanni
Giovanni
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 6 guests