ex_init4.c

来自「picoos源码。The RTOS and the TCP/IP stack 」· C语言 代码 · 共 44 行

C
44
字号
/*
 *  pico]OS initialization example 4
 *
 *  How to initialize the pico- and the nano- layer.
 *
 *  License:  modified BSD, see license.txt in the picoos root directory.
 *
 */

#include <picoos.h>

#if POSCFG_ENABLE_NANO == 0
#error This example needs the nano layer!
#endif


/* setup memory for the heap that is managed by the nano layer */
#define HEAPSIZE 0x2000
static char membuf_g[HEAPSIZE];
void *__heap_start  = (void*) &membuf_g[0];
void *__heap_end    = (void*) &membuf_g[HEAPSIZE-1];


/* function prototype: first task function */
void firsttask(void *arg);


/* Program main function.
 * This function starts pico]OS by initializing the nano layer.
 */
int main(void)
{
  nosInit(firsttask, /* ptr to function: first task that is executed */
          NULL,      /* optional argument, not used here             */
          1,         /* priority of the first task                   */
          0,         /* stack size for the first task, 0 = default   */
          0);        /* stack size for the idle task, 0 = default    */

  /* Note: The call to nosInit() will never return */

  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?