Page 1 of 1

Arduino Mega Port memory crash

Posted: Wed Dec 19, 2018 11:59 pm
by Stephen
Good day All!

AM very new to the platform. i wish to use it as part of a library i working on for the AVR platform mostly Arduino Mega baord.

I have tested the library code blink(niblink and chblink) example using Arduino 1.8.2 IDE with arduino mega(atmega 2560)

The example did work. although i wanted to check the amount of memory being use
sso i made a call to the function below inside the thread function.

Code: Select all

int freeMemory() {
  int free_memory;
  if ((int)__brkval == 0) {
    free_memory = ((int)&free_memory) - ((int)&__heap_start);
  } else {
    free_memory = ((int)&free_memory) - ((int)__brkval);
    free_memory += freeListSize();
  }
  return free_memory;
}


i Have tested the function with other code and it does return acceptable result
Although in this case i can see that the difereece between Stack pointer and Heap pointer is -2265(niBlink) and -461(chBlinks in this case i still can see the led flash). however, this show an overflow of memory. i wish to use chibios as part of a larger project so this behavior is unexpected as i come to chibios understanding that it was lightweight and stack only.

can one suggest some help here! Also i havnet touch any config file as yet.

Regards!

Re: Arduino Mega Port memory crash  Topic is solved

Posted: Thu Dec 20, 2018 2:19 pm
by tfAteba
Hi Stephen,

First of all ChibiOS is not intégrate to Arduino IDE, did you do it by yourself or did you use the work of another person, because I know that there is an old port outside, I don't remember the github link. Sorry

I ask that because I want to Know the version of chibios that you use.

Where did you test you code? Are you sur about the sintax?

I will try to reproduce you problem in my side, I have never seem all the macro that you have used in your demo. I'm curious to read about it.