STM32F100 hangs with a simple Thread depending on the cfg

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
noether
Posts: 91
Joined: Wed Nov 16, 2011 3:18 pm

STM32F100 hangs with a simple Thread depending on the cfg

Post by noether »

Hi, sorry for the title, but I can not find a suitable one for describing what is happening here.

I am dealing with a STM32F100C8 (8KB RAM and 64KB Flash).
I have modified the linker script SM32F100xB with the new lenght of the Flash (before it was set to 128KB).

The next main works as expected blinking the red LED if #define HAL_USE_I2C is set to TRUE, if not, it hangs.

Code: Select all

#include "ch.h"
#include "hal.h"

static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {

    (void)arg;
    chRegSetThreadName("blinker");

    while (TRUE) {
        palSetPad(GPIOB, GPIOB_LED_RED);
        chThdSleepMilliseconds(500);
        palClearPad(GPIOB, GPIOB_LED_RED);
        chThdSleepMilliseconds(500);
    }

    return 0;
}


int main(void) {

    halInit();
    chSysInit();

    chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

    while (TRUE) {
        chThdSleepMilliseconds(500);
    }
}


The next code hangs and it is independent on defining I2C TRUE or FALSE.

Code: Select all

#include "ch.h"
#include "hal.h"

static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {

    (void)arg;
    chRegSetThreadName("blinker");

    while (TRUE) {
        chThdSleepMilliseconds(500);
    }

    return 0;
}


int main(void) {

    halInit();
    chSysInit();

    chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

    while (TRUE) {
        palSetPad(GPIOB, GPIOB_LED_RED);
        chThdSleepMilliseconds(500);
        palClearPad(GPIOB, GPIOB_LED_RED);
        chThdSleepMilliseconds(500);
    }
}


Any clues about what is going on?
noether
Posts: 91
Joined: Wed Nov 16, 2011 3:18 pm

Re: STM32F100 hangs with a simple Thread depending on the cf

Post by noether »

Solved... it is not related with ChibiOS.

I was using the same script for flashing as for the STM32F4. Where I only erased 4 sectors.

4 sectors in F4 is 32KB, in the F100 is 4KB, therefore the flashing was wrong (the binary for the F100 was bigger than 4KB).
Post Reply