This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using Enumerations problem?

Hi,

I'm using the MCBSTM32E board with STM32F103ZE uC.

If I declare an enumeration type as 'static' in a function or as a global variable then the compiler signals no error or warning but the application simply does not run.

typedef enum{
first=1,
second=2
}TeMyEnum;

void vMyFunc(){
 static TeMyEnum eMyEnum=second;
}

Where do I go wrong?

Thanks
Henk

Parents
  • WEIRD!

    If I write some application then downloading it, it automatically starts to run. (set in the flash configuration). However, pressing the RESET button does not restart the application. (The Leds don't light up).

    But...

    Whe using some static variable then the download does not start the application but when I press the RESET button is DOES start!

    weird...weird...weird...

    Do I miss something regarding the RESET situation?

    Henk

Reply
  • WEIRD!

    If I write some application then downloading it, it automatically starts to run. (set in the flash configuration). However, pressing the RESET button does not restart the application. (The Leds don't light up).

    But...

    Whe using some static variable then the download does not start the application but when I press the RESET button is DOES start!

    weird...weird...weird...

    Do I miss something regarding the RESET situation?

    Henk

Children
  • I suspect you are looking at a lot of red herrings.

    Most likely, there is something wrong with your memory setup (and/or Stack setup), and your program is crashing due to invalid memory accesses...

    "I think the board stays in bootmode"

    Again, why do you think that?

    What debugging have you done to confirm that hypothesis?

    Remember: nobody else can see your code; nobody else can probe your system - we rely entirely on the information that you provide!

    How are you downloading?

  • First things first:

    >Most likely, there is something wrong with your
    > memory setup (and/or Stack setup), and your program
    > is crashing due to invalid memory accesses...

    I think you could be right. It seems like a memory problem.
    I'm new to this ARM stuff.
    My project includes the STM32F10x.s and my main.c file only includes stm32f10x.h.

    I think that is sufficient for proper stack e.t.c. initialisation.

    I assume that when selecting the correct processortype in uVision that memory settings will be okay?

    I download using the ULINK-ME interface shipped with the board.

  • I assume that when selecting the correct processortype in uVision that memory settings will be okay?

    Of course not - it is entirely dependent on your application. Did you enable all errors/warnings in the compiler/linker settings?

  • No, as Tamir says, that is not a valid assumption at all - you need to ensure that it is appropriate to your particular application.

    "I download using the ULINK-ME"

    A uLink-ME is not just for downloading - it is also a debug adapter:

    "The ULINK-ME connects your PC's USB port to your target system (via JTAG or SWD) and allows you to program and debug embedded programs on the target hardware."
    http://www.keil.com/ulinkme/default.asp

    Time to start debugging!

  • SOLVED!

    >Did you enable all errors/warnings in the compiler/linker settings?

    I always do.

    >Start Debugging

    I allready did but the debugger steps through my program but the Leds do not react.

    Both BOOTn pins connectors where unconnected on the board. The jumpers where positioned sidewards. After putting a jumper between BOOT0 and GND (Boot from Flash) the program and RESET buttons run solid as a rock!

    Henk (feeling a little ashame) ;-)

    Guys, thanks for your help!

  • We've all been there at some point!!