在龍芯1c上用RT Thread列印hello

2021-08-03 19:02:38 字數 3007 閱讀 3886

rt-thread的官方git是

rt-thread官方的《rt-thread程式設計指南》中有新建執行緒的例子,這裡參考裡面的例子新建乙個靜態執行緒,並在新建的執行緒中列印hello。

先來看看《rt-thread程式設計指南》中關於靜態執行緒的介紹

在文件中,緊隨其後有例子。

總結一下就是先定義好執行緒的棧,入口函式,然後呼叫函式rt_thread_init()初始化,最後呼叫函式rt_thread_startup()啟動該執行緒。

/*

* this file is part of rt-thread rtos

* * the license and distribution terms for this file may be

* found in the file license in this distribution or at

* * * change logs:

* date author notes

* 2010-06-25 bernard first version

* 2011-08-08 lgnq modified for loongson ls1b

* 2015-07-06 chinesebear modified for loongson ls1c

*/#include #include // 測試用的執行緒

#define thread_test_priority (25)

#define thread_test_stack_size (4*1024) // 4k

#define thread_test_timeslice (10)

struct rt_thread thread_test;

align(8)

rt_uint8_t thread_test_stack[thread_test_stack_size];

// 測試用的執行緒的入口

void thread_test_entry(void *parameter)

}void rt_init_thread_entry(void *parameter)

else

return 0;

}

其中第乙個init執行緒為rt-thread自帶的,我新建了乙個測試執行緒thread_test。

press to execute loading image:t

press any other key to abort.

00loading file: t (elf)

0x80200000/113616 + 0x8021bbd0/19472(z) + 469 syms-

entry address is 80200000

g root=/dev/mtdblock1 noinitrd init=/linuxrc rw rootfstype=yaffs2 console=ttys2,115200

zero at v0 v1 a0 a1 a2 a3

00000000 00000000 00000000 00000000 00000007 a10ffc60 a10ffc80 8008e650

t0 t1 t2 t3 t4 t5 t6 t7

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

s0 s1 s2 s3 s4 s5 s6 s7

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

t8 t9 k0 k1 gp sp s8 ra

00000000 00000000 00000000 00000000 00000000 a10ffc40 00000000 8005a840

cpu configure: 0x80000482

cpu:loongson 1c

dcache 16kb, linesize 32 bytes.

icache 16kb, linesize 32 bytes.

enable cpu cache done

current sr: 0x20000800

\ | /

- rt - thread operating system

/ | \ 2.1.0 build jul 11 2017

msh >

[thread_test_entry] hello...

[thread_test_entry] hello......

[thread_test_entry] hello......

[thread_test_entry] hello......

[thread_test_entry] hello......

[thread_test_entry] hello......

[thread_test_entry] hello......

[thread_test_entry] hello......

[thread_test_entry] hello......

[thread_test_entry] hello......

在龍芯1c微控制器上獲取MPU6050的原始資料

mpu6050和其它感測器有類似的地方,也有不同的地方。類似的地方是輸出乙個物理量,比如加速度值,角速度值,溫度值等。不同的地方是mpu6050輸出的資料可以通過一些演算法處理後,得到一些更 高階 更 人性化 的一些概念和資料。比如,可以將mpu6050輸出的資料處理後,得到當前的運動狀態,甚至通過...

用pyhon在螢幕上列印字串

python對字串的處理十分強大,不需要像c語言那樣設定不同型別的變數,或者需要經常使用與字串相關的函式。在python中,對字串的處理常常和對其他型別的資料的處理方式是類似的。在螢幕上輸出自己的英文名 print ricardo 直接輸出在螢幕上輸出 ricardo 或者使用乙個變數 python...

用C語言在螢幕上列印九九乘法表

c語言練習題目錄索引 題目 在螢幕上列印九九乘法表 注意格式對齊 解題思路 列印九九乘法表這裡用兩個for巢狀,抓住以下三點,這題就變得很簡單了。1.本題需要使用雙重迴圈,外層迴圈輸出行,內層迴圈輸出列.2.行需要迴圈9次.3.列迴圈的次數等於行迴圈的次數 這裡要額外說的是列印出來的格式。這裡介紹一...