Page 1 of 1

NIL without HAL  Topic is solved

Posted: Thu Dec 01, 2016 2:27 pm
by tfAteba
Hi Giovanni,

Is it possible to use NIL without HAL ?
My target is an Arduino uno.

I want to use NIL for the RTOS mechanisms that it offer and want to use my own peripherals implementation.
So here is what I did:
I have bring up all file to have the NIL RTOS in my application. Here is the files:
- nil.c and .h
- nilconf.h
- niicore.c and .h
- niltypes.h

I also have a makefile and a main.c file.

I have include nil in my application and it build successfully.

The main use a thread to blink an LED:

Code: Select all

/*
 * Thread 2.
 */
THD_WORKING_AREA(waThread1, 128);
THD_FUNCTION(Thread1, arg) {

  (void)arg;

  while (true) {
    PORTB &= ~(1 << 5);
    chThdSleepMilliseconds(500);
    PORTB |= (1 << 5);
    chThdSleepMilliseconds(2000);
  }
}


But it don't work.

I think there is a problem of time that must be use to generate the chThdSleepMilliseconds delay but I'm not sure!

- Did I need to use another file for this?
- Is it possible to do that another way?

Thanks!

Re: NIL without HAL

Posted: Thu Dec 01, 2016 3:05 pm
by Giovanni
Hi,

Look at the demos \demos\various\NIL-ARMCM0-GENERIC or \demos\various\NIL-ARMCM4-GENERIC, it is just NIL without HAL.

You need to provide the system tick by yourself because that is usually provided by the HAL ST driver.

Giovanni

Re: NIL without HAL

Posted: Thu Dec 01, 2016 3:14 pm
by tfAteba
Ok, I was thinking about timer, I was not so far but not sure.

So I have to provide the system tick :) to make it work.

I will look at those example to understand what going on.

Thanks.