Skip to content

When process "new" ,STM32F103C8 "Bluepill" freeze. #1002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
human890209 opened this issue Jul 30, 2018 · 3 comments
Closed

When process "new" ,STM32F103C8 "Bluepill" freeze. #1002

human890209 opened this issue Jul 30, 2018 · 3 comments

Comments

@human890209
Copy link

human890209 commented Jul 30, 2018

Hi,
I tried using STM32F103C8 "Bluepill" today. Cause it is supported by Arduino IDE.
Everything is here. https://github.com/rogerclarkmelbourne/Arduino_STM32
I tested the Blink example both with Arduino IDE and Sloeber, they both worked!
Then I continue to do more tests with Sloeber, cause it's better for me:>
Then I got this bug with "new". Here I paste the simple bug reproduce sketch code.

class MYCLASS
{
public:
	MYCLASS(){content = 99;};
	~MYCLASS(){};
	byte content;
};

MYCLASS mc;

MYCLASS* mcp;

void setup()
{
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
	Serial.println("loop");
	digitalWrite(LED_BUILTIN, HIGH);
	delay(500);
	digitalWrite(LED_BUILTIN, LOW);
	delay(500);
	Serial.println(mc.content);
	mcp = new MYCLASS();
	Serial.println((*mcp).content + 1);
	delete(mcp);
}

SerialMonitor(Sloeber):

Connect to serial portCOM3 at115200
99

I tried the same code in Arduino IDE. Everything works fine! (Took me much time to find out it's not a pure hardware bug...Asked around on the STM32 Arduino Github Issues and Forum, cause Arduino IDE works fine, I came here to find a way out.)

This is my project setting of Sloeber
arduino settings
Simply use the same default setting to Arduino IDE.

I'm sure "new" is the problem. Cause mcp = &mc; works fine with Sloeber.

Hope you could help me out with the "new"+"STM32 Bluepill"+"Sloeber" bug.
It will be awesome if STM32 Bluepills can be used with Sloeber. When Flash and SRAM get larger Sloeber is in need.

I found a warning in the compiling log. Maybe this could do some help.

'Starting combiner'
"C:\sloeber\/arduinoPlugin/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++" -Os -Wl,--gc-sections -mcpu=cortex-m3 "-TD:\Arduino\Software\Sloeber\MyHardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c/ld/jtag_c8.ld" "-Wl,-Map,C:\Users\human\Documents\sloeber-workspace\STM32F103C/Release/STM32F103C.map" "-LD:\Arduino\Software\Sloeber\MyHardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c/ld" -o "C:\Users\human\Documents\sloeber-workspace\STM32F103C/Release/STM32F103C.elf" "-LC:\Users\human\Documents\sloeber-workspace\STM32F103C/Release" -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group    .\sloeber.ino.cpp.o    C:/Users/human/Documents/sloeber-workspace/STM32F103C/Release/arduino.ar  -Wl,--end-group
**c:/sloeber/arduinoplugin/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/lib/armv7-m\libnosys.a(sbrk.o): In function `_sbrk':
sbrk.c:(.text._sbrk+0x30): warning: undefined reference to `end'**
'Finished building: STM32F103C.elf'
@human890209 human890209 changed the title When process "new" with STM32F103C8 "Bluepill" freeze. When process "new" ,STM32F103C8 "Bluepill" freeze. Jul 30, 2018
@human890209
Copy link
Author

Here is the solution:
http://www.stm32duino.com/viewtopic.php?f=3&t=3941&p=47745#p47745

@jantje
Copy link
Member

jantje commented Jul 31, 2018

Great you fixed this yourself.

@RickKimball
Copy link

The solution suggested above was a work around. The real problem has actually been fixed by #1005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants