1+2
This commit is contained in:
@@ -27,6 +27,8 @@ INC += -I"$(SRC_DIR)/ucos_v1_42/ucos/components/ucos_standalone/src/common"
|
||||
INC += -I"$(SRC_DIR)/Xilinx/libsrc/ipipsu_v2_3/src/"
|
||||
INC += -I"$(SRC_DIR)/Modules/MMU"
|
||||
|
||||
INC += -I"$(SRC_DIR)/Xilinx/include/"
|
||||
|
||||
|
||||
INC += -I"$(SRC_DIR)/Xilinx/libsrc/ipipsu_v2_3/src/"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ SRC += $(SRC_DIR)/ucos_v1_42/ucos/bsp/src/$(ARCH)/asm_vectors.S
|
||||
|
||||
-include $(SRC_DIR)/ucos_v1_42/micrium_source/uC-LIB/subdir.mk
|
||||
|
||||
SRC += $(SRC_DIR)/ucos_v1_42/ucos/components/ucos_osii/bsp/$(ARCH)/ucos_osii_bsp.c
|
||||
SRC += $(SRC_DIR)/ucos_v1_42/ucos/components/ucos_osii/src/bsp/$(ARCH)/ucos_osii_bsp.c
|
||||
SRC += $(SRC_DIR)/ucos_v1_42/ucos/components/ucos_common/src/$(ARCH)/cpu_bsp.c
|
||||
|
||||
SRC += $(SRC_DIR)/Modules/MMU/mmu.c
|
||||
|
||||
@@ -16,68 +16,78 @@
|
||||
#include "xil_testmem.h"
|
||||
#include "xil_printf.h"
|
||||
|
||||
#define HELLO_WORLD_TASK_PRIO 64
|
||||
#define CALC_TASK_PRIO 64
|
||||
#define HELLO_WORLD_TASK_PRIO 30
|
||||
#define CALC_TASK_PRIO 31
|
||||
|
||||
#define HELLO_WORLD_TASK_STK_SIZE 16
|
||||
#define CALC_TASK_STK_SIZE 32
|
||||
#define HELLO_WORLD_TASK_STK_SIZE 16000
|
||||
#define CALC_TASK_STK_SIZE 32000
|
||||
|
||||
static OS_STK HelloWorldTaskStk[HELLO_WORLD_TASK_STK_SIZE];
|
||||
static OS_STK CalcTaskStk[HELLO_WORLD_TASK_STK_SIZE];
|
||||
|
||||
|
||||
int f(int n)
|
||||
int f(uint8_t n)
|
||||
{
|
||||
if (n == 1)
|
||||
if (n <= 1)
|
||||
return n;
|
||||
else
|
||||
return (f(n-1) + f(n-3));
|
||||
return (f(n-1) + f(n-2));
|
||||
}
|
||||
|
||||
void HelloWorldTask (void *pdata)
|
||||
{
|
||||
while(1){
|
||||
UCOS_Printf("Hello World!");
|
||||
UCOS_Printf("Hello World!\n");
|
||||
OSTimeDly(OS_TICKS_PER_SEC*50);
|
||||
}
|
||||
}
|
||||
|
||||
void CalcTask (void *pdata)
|
||||
{
|
||||
uint8_t n=50;
|
||||
for (uint8_t i = 1; i <= n; i)
|
||||
{
|
||||
UCOS_Printf("%u", f(i));
|
||||
}
|
||||
while(1){
|
||||
uint8_t n=50;
|
||||
for (uint8_t i = 1; i <= n; i++)
|
||||
{
|
||||
UCOS_Printf("%d", f(i));
|
||||
OSTimeDly(OS_TICKS_PER_SEC*1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InitDoneCallback(void * p_arg){
|
||||
(void) p_arg;
|
||||
UCOS_Print("OS started!\r\n");
|
||||
|
||||
|
||||
OSTaskCreateExt(HelloWorldTask,
|
||||
0,
|
||||
&HelloWorldTaskStk[0],
|
||||
HELLO_WORLD_TASK_PRIO,
|
||||
&HelloWorldTaskStk[0],
|
||||
0,
|
||||
0);
|
||||
0,
|
||||
&HelloWorldTaskStk[HELLO_WORLD_TASK_STK_SIZE-1],
|
||||
HELLO_WORLD_TASK_PRIO,
|
||||
HELLO_WORLD_TASK_PRIO,
|
||||
&HelloWorldTaskStk[0],
|
||||
HELLO_WORLD_TASK_STK_SIZE,
|
||||
0,
|
||||
0);
|
||||
|
||||
OSTaskCreateExt(CalcTask,
|
||||
0,
|
||||
CALC_TASK_PRIO,
|
||||
CALC_TASK_PRIO,
|
||||
&CalcTaskStk[0],
|
||||
CALC_TASK_STK_SIZE,
|
||||
0
|
||||
);
|
||||
0,
|
||||
&CalcTaskStk[CALC_TASK_STK_SIZE-1],
|
||||
CALC_TASK_PRIO,
|
||||
CALC_TASK_PRIO,
|
||||
&CalcTaskStk[0],
|
||||
CALC_TASK_STK_SIZE,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
while(1){
|
||||
OSTimeDly();
|
||||
OSTimeDly(1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
||||
MMUInit();
|
||||
UCOSStartup(InitDoneCallback);
|
||||
while (1);;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user