-
Notifications
You must be signed in to change notification settings - Fork 475
Description
Describe the bug
The OS seems to use memory that is reserved to the apps. The apps have a limited heap area in the ram defined by the space between &_heap_start
and &_heap_end
but when an app changes the values in the heap, it makes the OS unstable when the app is ended.
For example, if you run an app that fill the heap with zeroes, you will be back in the home menu and you will be able to use other apps such as Python. But if you press the [Home] button, the calculator crashes and restart. It might be related to this issue. This crash seems to happen since version 24.2.0 (or 24.2.2) and we have not been able to reproduce it on N0110 so it seems to be an issue with the memory addresses of this specific model. We have finally been able to get the same crash on N0110 so we suppose that this issue is related to the latest Epsilon version.
We have not found a workaround to this issue and it slows down the development of some big third party app projects such as Numcraft of Peanut GB so please consider looking at this issue.
Screenshots
Nothing interesting.
To Reproduce
Tested on N0120
Steps to reproduce the behavior:
- Clone the epsilon-sample-app-c.
- Replace the main.c code with the following :
#include <stdint.h>
#include <stdlib.h>
const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "App";
const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;
int main()
{
while (1)
{
uint32_t *memory = malloc(1);
if (memory == 0)
{
break;
}
*memory = 0;
}
}
- Compile the app and send it to the calculator.
- Run the app, it should close immediately.
- Go to another app such as the Python app and press [Home].
- The calculator should crash.
Additionally, you can try with this code :
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "App";
const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;
extern char _heap_start;
extern char _heap_end;
int main()
{
memset(&_heap_start, 0, &_heap_end - &_heap_start);
}
Expected behavior
The calculator should not crash.
Environment
- Epsilon version: 24.3.0.
- The platform(s) on which the problem happens: actual device