EM::Blocks STM32F103xB assert_failed Problem

#3349504
Lesenswert?

Hallo liebe mikrocontroller Community,

ich nutze die neuste Version von EM::Blocks und habe ein kleines Problem 
mit meinen Programm. Ich erstelle eine klasse mit der ich einen Ausgang 
definiere und habe zwei funktionen um den Ausgang high oder low zu 
setzen. Mit dem IAR Compiler funktioniert alles. Wenn ich es allerdings 
mit EM::Blocks übersetze funktioniert das compilieren aber wenn er die 
Klasse erstellen will springt das Programm in die assert_failed 
Funktion. Ich denke mir fehlen nur ein paar Einstellungen aber ich komme 
nicht drauf welche....

Mein Code:

main.cpp
1
#include "stm32f10x.h"
2
//#include "drv_LED.h"
3
#include "output.h"
4

5
int main()
6
{
7
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
8

9
  output LED(GPIO_Pin_5, GPIOB, GPIO_Mode_Out_PP, GPIO_Speed_50MHz);
10

11
  while(1)
12
  {
13
    LED.high();
14
    //LED.low();
15
  }
16
}
17

18

19

20

21
#ifdef __cplusplus
22
 extern "C" {
23
#endif
24

25
void assert_failed(uint8_t* file, uint32_t line)
26
{
27

28
  while(1)
29
  {
30
      // parameter error
31
  }
32
}
33

34

35

36
#ifdef __cplusplus
37
 }
38
#endif

output.cpp
1
#include "stm32f10x.h"
2
#include "output.h"
3

4
output::output()
5
    {
6

7
    }
8

9
output::output(uint16_t Pin, GPIO_TypeDef* Port, GPIOMode_TypeDef Mode, GPIOSpeed_TypeDef Speed)
10
: Pin(Pin), Port(Port)
11
    {
12
        GPIO_InitTypeDef  GPIO_InitStructure;
13

14
        /* Configure the GPIO_LED pin */
15
        GPIO_InitStructure.GPIO_Pin = Pin;
16
        GPIO_InitStructure.GPIO_Mode = Mode;
17
        GPIO_InitStructure.GPIO_Speed = Speed;
18

19
        GPIO_Init(Port, &GPIO_InitStructure);
20
    }
21

22
output::~output()
23
{
24

25
}
26

27
void output::high()
28
    {
29
        GPIO_WriteBit(Port, Pin, Bit_SET);
30
    }
31

32
void output::low()
33
    {
34
        GPIO_WriteBit(Port, Pin, Bit_RESET);
35
    }

Die Einstellungen sind fast alle wie die EM::Blocks automatisch erstellt 
nur beim Linker habe ich eingestellt das er C++ libaries nutzen soll.

Danke schon einmal.

Gruß jonas
#3442679
Lesenswert?

Hey,

also ich kann nun erfreulicher Weise sagen das ich das obere Problem 
behoben bekommen habe. Hatte wohl den Flash und RAM size falsch 
angegeben.

Allerdings hab ich nun nen neues Problem welches plötzlich aufgetaucht 
ist. Ich bin mir nicht bewusst das ich irgendeine Einstellung geändert 
habe. Es hatte aber alles Funktioniert. Das Problem ist nun das ich 
nicht Debuggen kann. Ich kann keine Breakpoints setzen und wenn ich das 
Programm Stoppe kommt kein Cursor und man weiß nicht wo er stehen 
geblieben ist. Das Programm wird aber in den mC geladen und läuft dort 
allein. Bekomme dann die Meldeung Error: No line xxx in file yyyy. Egal 
wo ich den Breakpoint setzen will. Die Startup Datei wird normal 
durchlaufen aber ab dann ist schluß.

Habe auch nen neues Projekt aufgesetzt wo ich nur in die Main gehe das 
funktioniert.

Ich weiß einfach nicht weiter....

LG Jonas
Gast #3443093
Lesenswert?

Jonas Damhuis schrieb:
> Ich weiß einfach nicht weiter....
Nach Schema F vorgehen: High-Level-Systeme rausnehmen, Komplexität 
verringern, Fehler suchen.
Das heißt hier: Den GDB direkt auf der Konsole starten und damit 
debuggen, dann gibts tendentiell sinvollere Fehlermeldungen als "kein 
Cursor erscheint".

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren