Lazuli是針對AVR微控制器的先發製人多任務RTO(實時操作系統/內核)。它允許在AVR微控制器上的實時上下文中編程和運行多個獨立的任務。 Lazuli RTO在其基本配置中的內存足跡較低(ROM <4千鍵,<200個字節的靜態RAM)。 Lazuli RTO可用於開發具有強大實時限製或需求多任務處理的嵌入式應用程序或固件。
AVR MCU被廣泛用於嵌入式工業設備和應用中,也已知在Arduino板上使用。在Lazuli RTOS的頂部編寫的應用程序以及業餘愛好者的創作。
Lazuli RTOS以其源代碼表格分發,旨在構建並與您自己的最終可執行文件靜態鏈接。這使得內核可以靜態配置,並受益於編譯器優化。
該項目在https://github.com/randruc/lazuli上託管
目前,Lazuli內核提供以下功能:
SCHED_RR )printf()實現Lazuli項目具有非常具體的目標,使其與眾不同。這些都是:
Lazuli RTOS目前運行在Atmega328p MCU上(在Arduino上使用),但應容易移植到其他AVR平台。
儘管Lazuli傾向於達到高度的代碼質量和穩定性,但它不適合安全系統,因為它未通過這些特定用途進行認證。有關什麼是安全 - 關鍵系統的更多信息,請閱讀https://en.wikipedia.org/wiki/safety-critical_system
該項目的文檔可以在https://lazuli.readthedocs.io/en/latest/上閱讀
可以在https://randruc.github.io/lazuli/doxygen/latest/上讀取API文檔
使用兩種不同的工具來記錄該項目:
sphinx從重組文本編寫的文件中生成用戶文檔。來源在文檔/目錄中。doxygen API文檔。 使用Lazuli RTO的示例程序可以在目錄示例程序中找到。
這裡顯示了經典的閃爍LED。嵌入式系統的Hello世界。人們對Lazuli API的介紹進行了大量評論。
#include <stdint.h>
#include <Lazuli/lazuli.h>
#include <Lazuli/sys/arch/AVR/registers.h>
/*
* This is the Blink task. It simply blinks the built-in LED on Arduino
* platforms.
* This task is scheduled in real-time. It is configured to blink with an exact
* period of 1 second.
*/
void
Blink ()
{
/* On the Arduino, this pin corresponds to the built-in LED */
const uint8_t ledPin = 0x20 ;
DDRB |= ledPin ; /* Set the pin to be an output pin */
PORTB &= ~ ledPin ; /* The initial state of the pin will be 0 */
/* Now this is the main loop of this task */
for (;;) {
/* Wait for the next real-time activation of the task */
Lz_Task_WaitActivation ();
PINB |= ledPin ; /* Toggle the pin */
}
}
void
main ( void )
{
/* Allocate a configuration object on the stack */
Lz_TaskConfiguration configuration ;
/* Initialize the configuration object with default values */
Lz_TaskConfiguration_Init ( & configuration );
/* Configure the Blink task to be cyclic real-time (RMS scheduling) */
configuration . schedulingPolicy = CYCLIC_RT ;
/* The Blink task has a period of 25 time slices. */
/* Our platform has a 16 MHz clock, and the system clock resolution */
/* frequency is configured to 50 Hz. This is an arbitrary value that */
/* can be configured by the user. */
/* With a system clock resolution frequency set to 50 Hz, the system */
/* clock period is then 1 / 50 = 0.02 second. */
/* So 0.02 * 25 = 0.5 second, which corresponds to the half period */
/* of our task. */
configuration . period = 25 ;
/* The Blink task has a completion of 10 time slices (arbitrary here */
/* because our task does almost nothing). */
configuration . completion = 10 ;
/* Register the Blink task to run with the parameters above */
Lz_RegisterTask ( Blink , & configuration );
/* Run the system */
Lz_Run ();
}Lazuli對任何其他現有代碼都不依賴。您可以簡單地編寫自己的代碼,構建系統,將其上傳到目標MCU,然後運行!
要使用Lazuli開發,強烈建議使用Lazuli Docker圖像。您將從完整的開發環境中受益,並提供所有必要的工具。
Lazuli RTO帶有一個完整的容器化開發環境,作為Docker圖像。該圖像包括使用Lazuli RTO構建自己項目所需的所有工具。它包括編譯器和鏈接器,構建工具,二進制實用程序,人頁面等。
可以從https://hub.docker.com/r/randruc/lazuli提取官方的Lazuli Docker圖像
閱讀有關如何在官方文檔中設置開發環境的更多信息:https://lazuli.readthedocs.io/en/latest/set_up_environment.html
Lazuli開發環境容器啟動
Lazuli開發環境容器中的人頁面
Lazuli內核是完全可配置的。構建系統依賴於CMAKE。借助ccmake ,也可以在控制台中進行交互進行配置。
在官方文檔中閱讀更多信息:https://lazuli.readthedocs.io/en/latest/developing_your_project.html
使用CCMAKE配置
使用CMAKE建造
在AVR MCUS上, avrdude可用於將最終二進制載荷上傳到目標機器。腳本腳本/avr/upload.sh可以使用。它將十六進製文件作為參數。
與串行線的相互作用可以在GNU screen的幫助下完成。腳本腳本/serial.sh可用於與USB串行線進行交互。
該項目的Issues選項卡(https://github.com/randruc/lazuli/issues)必須用於報告故障排除或提出建議。
歡迎捐款!
該項目託管在GitHub(https://github.com/randruc/lazuli)上,Github用於管理所有內容:拉出請求,問題等。您希望修復錯誤,實現或建議新功能,或解決錯誤/拼寫錯誤/拼寫錯誤:歡迎任何類型的貢獻!
閱讀有關如何在官方文檔中做出貢獻的更多信息:https://lazuli.readthedocs.io/en/latest/kernel/kernel/contributing.html
您還可以使用項目選項卡的Issues來提出問題,建議不編碼或您想要的任何內容!
所有項目僅根據GNU通用公共許可證v3.0分發。該許可證的完整副本可在文件許可證/gpl-3.0-only.txt中獲得。