thanks for your reply.
I setup a simple program including as you suggested only timer and serial driver.
I reported below the example.
I see the led flashing with the correct delay. so the timer seems to work.
I cannot see any output on the serial. What I see with the avrStudio debugging this code, it seems that kdginit is not exapndend in any code and the parameters passed debugging the printf as the fd struct not properly initialized.
you can change compilation parameters by modifying your project's makefile, located in [project]/[project]_user.mk. Flags changed in that file will overwrite the defaults.
Bear in mind, though, that BeRTOS has 2 implementations of the serial port: one is used for debugging purposes only, it's slow and safe; the other can be used to transfer all types of data, it's fast and it exposes a kfile interface.
The former is the kdebug serial port, which is initialized with kdbg_init() and can be used with kprintf() or LOG_*() functions (see the logging tutorial
for more information). The implementation can be found in bertos/cpu/avr/drv/kdebug_avr.h.
The latter is the proper UART port, which is initialized with ser_init() and accessed with the KFile interface
. To implement the serial driver, you need to look at bertos/cpu/avr/drv/ser_avr.c.
// Empty main.c file generated by the wizard
static Serial out;
static void init(void)
// insert initialization calls here
DDRJ |= BV(PJ4) + BV(PJ3)+ BV(PJ7);
PORTJ |= BV(PJ3) + BV(PJ7);
Here you have initialized the same UART two times, one for kdebug and one for serial. By default, the debug port opens on serial port 0 and with 115200 bps, but you can change that using the wizard or by editing cfg/cfg_debug.h.
For now, I suggest you to remove the ser_* and kfile_* calls and try to see output using kprintf() only. kdbg_init() prints the string "*** BeRTOS debug starting ***" (or something similar), if you see that you're done; if not, double check the port number, the baud rate and the code.
As a side note, I suggest to encapsulate Led code into macros, so that it's easy to port the project to another board; see the HAL tutorial