-
I am not sure if it caused by the megaTinyCore but it seems possible since I did not found much other possibilitys. When I run this code: struct SimpleStruct }; SimpleStruct *rootSimpleStruct; int led = 4; // the loop function runs over and over again forever delay(1000); // wait for a second on my ESP32S2 it just works (LED is on) but on my ATtiny202 I still got a nullpointer (the LED blinks). It seems the nano works too. I clearly set with Are there others with that problem too? Are there resource problems or something like that? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
I'm sorry, I can't make hide nor hair of that code, what the fuck is it supposed to do? I may not have the CS background to understand what expected behavior is without primpting |
Beta Was this translation helpful? Give feedback.
-
My best guess, based on looking at the code, is that you are running out of RAM when calling new/malloc. When malloc is returning a nullpointer, it means the memory allocation has failed. Neither code is checking, if the allocation failed. And the 202 has only 128 Bytes of SRAM. |
Beta Was this translation helpful? Give feedback.
-
@MX682X - Out of curiosity, where the fuck is __malloc_margin actually defined? I cannot find anyplace that actually defines it, so I don't know how I could change it. I'm not sure it is a good idea to change, though, nor am I sure it even has to, because I think malloc() burns enough flash that it's not usable on 2k parts, and maybe I should just note that malloc is not an option with the 2k parts. But I'd like to be able to change it if I ever had to, yaknow? There are a lot of very important files that are so thoroughly buried that it's impossible to locate them I searched the toolchain, the core, the source for avr-gcc, and the source for avrlibc. I found lots of places where it was mentioned, and places where it was declared as an extern, but no actual definition of it. So I don't have a goddamned clue how it becomes set. |
Beta Was this translation helpful? Give feedback.
My best guess, based on looking at the code, is that you are running out of RAM when calling new/malloc. When malloc is returning a nullpointer, it means the memory allocation has failed. Neither code is checking, if the allocation failed. And the 202 has only 128 Bytes of SRAM.