Arduino Mega Port memory crash

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderators: utzig, tfAteba

Stephen
Posts: 1
Joined: Wed Dec 19, 2018 11:17 pm

Arduino Mega Port memory crash

Postby Stephen » Wed Dec 19, 2018 11:59 pm

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!

User avatar
tfAteba
Posts: 519
Joined: Fri Oct 16, 2015 11:03 pm
Location: Chartres, France
Has thanked: 78 times
Been thanked: 45 times

Re: Arduino Mega Port memory crash

Postby tfAteba » Thu Dec 20, 2018 2:19 pm

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.
regards,

Theo.


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 1 guest