Zephyr- thread not running

Hello,

I am using the nRF 9160 DK board. I am trying to create simple thread in Zephyr.

but the thread it's not running.

this is the code:

#include <zephyr.h>
#include <drivers/gpio.h>
#include <zephyr/device.h>
#include <string.h>

/* size of stack area used by each thread */
#define STACKSIZE 1024

/* scheduling priority used by each thread */
#define PRIORITY 7


static void thread_fn(void* a1, void* a2, void* a3)
{
	while (1)
	{
		printk("thread fn \n");
		k_msleep(500);
	}
	
}

K_THREAD_DEFINE(my_thread, 1024,
                thread_fn, NULL, NULL, NULL,
                7, 0, 0);




void main(void)
{
	printk("Hello World! %s\n", CONFIG_BOARD);
	k_thread_start(my_thread);						 
	while (1)
	{
		
	}
}


I tried also the other method that uses K_thread_create but it still the same problem.

Note: when I remove main() function it works

Related