We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi there, I'm using STM32F103 with Keil ver 4.72 I defined a structure like this:
typedef struct { uint16_t X; uint16_t Y; uint16_t Width; uint16_t Height; uint16_t BackColor; uint16_t TextColor; uint16_t TextBackColor; } button_t;
I use the struct in main file like this:
button_t btn1; int main() { btn1.X = 100; btn1.Y = 100; . . . while(1) { } }
When I use this struct in program, every things works well. The problem is when I add more members into the structure, like this:
typedef struct { uint16_t X; uint16_t Y; uint16_t Width; uint16_t Height; uint16_t BackColor; uint16_t TextColor; uint16_t TextBackColor; uint16_t TLX; uint16_t TLY; uint16_t TRX; uint16_t TRY; uint16_t BLX; uint16_t BLY; uint16_t BRX; uint16_t BRY; };
When I do that, program compiles without any problem, but when I download it into the MCU, it doesn't work. I increased Heap Size from 0x0200 to 0x0800, but took the same result. I set the Heap Size in startup.s file. I'm not sure if it's a right way to set that.
As I said before:
You've probably muffed up your memory allocation.
With all you've written since I could change that to::
You've almost definitely muffed up your memory allocation.
Check it!