chibios hal without RT

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

Moderator: RoccoMarco

Post Reply
noodlefighter
Posts: 2
Joined: Wed Apr 27, 2016 6:16 am

chibios hal without RT

Post by noodlefighter »

i try to use chibios/hal without rt-kenerl on stm32f103c8t6
but the interrupt does not work(i set a breakpoint in the ISR but never reach there)
everything works well when i use RT OSAL..

ChibiOS_3.0.5(in fact i had tried the latest version 16.1.4)
arm-none-eabi-gcc 5.2.1 20151202

i try to fit the example "testhal/STM32/STM32F1xx/UART" to bare-metal like this..
it only print out a line: "Starting..."

Code: Select all

#include "hal.h"

static void txend2(UARTDriver *uartp) {
  (void)uartp;
  osalSysLockFromISR();
  uartStartSendI(&UARTD2, 12, "Running...\r\n");
  osalSysUnlockFromISR();
}

static UARTConfig uart_cfg_1 = {
  NULL,
  txend2,
  NULL,
  NULL,
  NULL,
  38400,
  0,
  USART_CR2_LINEN,
  0
};

int main(void) {
  halInit();
//  chSysInit();

  uartStart(&UARTD2, &uart_cfg_1);
 
  uartStartSend(&UARTD2, 13, "Starting...\r\n");
 
  while (true) {
    osalThreadSleepMilliseconds(500);
  }
 
  return 0;
}



makefile

Code: Select all

# Startup files.
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f1xx.mk
# HAL-OSAL files (optional).
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/hal/ports/STM32/STM32F1xx/platform.mk
include $(CHIBIOS)/os/hal/boards/OLIMEX_STM32_P103/board.mk
#include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/hal/osal/os-less/ARMCMx/osal.mk
# RTOS files (optional).
#include $(CHIBIOS)/os/rt/rt.mk
#include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: chibios hal without RT

Post by Giovanni »

Hi,

You need to enable interrupts after you perform halInit(), interrupts are disabled on main() entry. See the demo HAL-STM32F407-DISCOVERY.

Code: Select all

/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   */
  halInit();

  /*
   * Enabling interrupts, initialization done.
   */
  osalSysEnable();



Giovanni
noodlefighter
Posts: 2
Joined: Wed Apr 27, 2016 6:16 am

Re: chibios hal without RT

Post by noodlefighter »

thanks a lot. really works! :D
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: chibios hal without RT

Post by Giovanni »

Glad to hear it.

Anyway let us know how it goes, HAL alone is not a common use case, most use the whole package.

Giovanni
Post Reply