FreeRTOS

Started by tha, October 08, 2021, 08:24:01 AM

Previous topic - Next topic

tha

     •  การระบุ files ที่เฉพาะเจาะจงไปยัง the compiler ที่กำลังถูกใช้:

        Compilers ที่เป้าหมายเป็น embedded systems จัดให้มีส่วนขยายบางอย่างสำหรับ the C language. ตัวอย่างเช่น, a special keyword อาจมีอยู่ที่ถูกใช้เพื่อ
        ระบุว่า a particular function ควรถูกคอมไพล์เป็น an interrupt handler.

        ส่วนขยายของ the C language, โดยการกำหนด, อยู่นอก the C standard ดังนั้นจึงแตกต่างจาก compiler หนึ่งถึง compiler หนึ่ง. The FreeRTOS files ที่
        บรรจุ non-standard syntax ดังกล่าวจะเป็นไฟล์เหล่านั้นภายใน the FreeRTOS/source/portable directory tree (ตามที่ไฮไลต์ด้านบน).  นอกจากนี้, some
        demo applications จะติดตั้ง interrupt handlers ซึ่งไม่ได้เป็นส่วนหนึ่งของ  FreeRTOS เอง. การกำหนดของ interrupt handlers ดังกล่าวและวิธีการติดตั้ง
        the interrupt handler อาจเป็นคำเฉพาะของคอมไพเลอร์ด้วย.

tha

     •  Low level files:

        The C startup file and linker script เป็นโดยเฉพาะ processor and compiler โดยทั่วไป. ไม่ควรสร้าง from เหล่านี้จากเริ่มต้น - แทนด้วยการมองหาผ่าน
        ทาง the existing FreeRTOS demo projects สำหรับ a file ที่เป็นตัวเลือกที่เหมาะสมสำหรับการปรับเปลี่ยน.

        ใช้ความระมัดระวังเป็นพิเศษกับ ARM7 C startup files. เหล่านี้ต้องกำหนดอย่างใดอย่างหนึ่ง the IRQ handler ถึง vector โดยตรงไปยัง the interrupt
        handler หรือ vector ไปยัง a common entry point. ตัวอย่างถูกจัดให้มีของทั้งสองวิธี. ไม่ว่าในกรณีใด the first code ที่ปฏิบัติหลังจาก the jump ต้องเป็น
        the FreeRTOS context save code, ไม่ใช้ code ตัวกลางที่จัดให้มีโดยคอมไพเลอร์ใดๆ. อีกครั้ง - ใช้ the existing files เป็นตัวอ้างอิง.

        Linker scripts ต้องถูกปรับและอธิบายอย่างถูกต้อง the memory map of the microcontroller ที่กำลังถูกใช้.

tha

     •  Project settings:

        ทุกๆ project จะกำหนดโดยปกติ a preprocessor macro ที่เฉพาะเจาะจงไปยัง the port ที่กำลังถูกคอมไพล์. The preprocessor macro ระบุซึ่ง
        portmacro.h file จะถูกรวมด้วย. ตัวอย่างเช่น, GCC_MEGA_AVR ต้องถูกกำหนดเมื่อใช้ GCC เพื่อคอมไพล์ the MegaAVR port. IAR_MEGA_AVR  ต้องถูก
        กำหนดเมื่อใช้ IAR เพื่อคอมไพล์ the MegaAVR port, ฯลฯ. อ้างถึง existing demo application projects และ the file
        FreeRTOS/source/include/portable.h เพื่อค้นหาการกำหนดที่ถูกต้องสำหรับ project ของคุณ. ถ้า the preprocessor macro ไม่ถูกกำหนดดังนั้น the
        directory ซึ่ง the relevant portmacro.h file ถูกอยู่ต้องถูกรวมใน the preprocessors include search path.

        การตั้งค่าคอมไพเลอร์อื่นๆ เช่น ตัวเลือกการปรับให้เหมาะสมก็มีความสำคัญเช่นกัน. อีกครั้งอ้างถึง existing demo application projects สำหรับตัวอย่าง.

        Compilers ที่มี an IDE based interface โดยทั่วไปจะรวม the target microcontroller เป็นส่วนหนึ่งของ of the project settings - นี้ต้องถูกปรับเพื่อให้
        ถูกต้องสำหรับ the new target. ในทำนองเดียวกันในกรณีที่ a makefile ถูกใช้, ตัวเลือกภายใน makefile จะต้องได้รับการอัปเดตเพื่อให้ถูกต้องสำหรับเป้าหมาย
        ไมโครคอนโทรลเลอร์ใหม่.

     • Configuring the tick interrupt:

        The tick interrupt ถูกกำหนดค่าโดย a function ที่เรียกว่า prvSetupTimerInterrupt(), ซึ่งสามารถถูกเอาไว้อยู่ภายใน
        FreeRTOS/source/portable/[compiler]/[microcontroller]/port.c.


tha

     •  RAM usage and ROM usage:

        The Memory Management section จัดให้มีข้อมูลทั้งหมดที่ต้องการเพื่อเข้าใจวิธีที่ FreeRTOS ใช้ RAM, และวิธีที่ RAM นี้ถูกจัดสรรไปยัง the RTOS
        kernel.

        ถ้าคุณกำลังแปลง an existing demo application เพื่อรันบน a microcontroller ที่มี RAM น้อยกว่าดังนั้นคุณอาจจำเป็นต้องลด the
        configTOTAL_HEAP_SIZE value - ที่ถูกเอาไว้อยู่ภายใน FreeRTOSConfig.h - และลดจำนวนของ tasks ที่ the demo สร้าง. การลดจำนวนของ tasks ที่
        สร้างสามารถถูกทำให้สำเร็จลงโดยเอาออกอย่างง่ายๆ the function calls ที่ใช้สร้าง the tasks ภายใน main(), ดังที่แสดงไว้ก่อนหน้านี้.

        ถ้าคุณกำลังแปลง an existing demo application เพื่อรันบน a microcontroller ที่มี ROM น้อยกว่าดังนั้นคุณอาจจำเป็นต้องลดจำนวนของ demo
        application files ที่ถูก included ในการบิวด์. เหล่านี้คือ the files ที่ถูกเอาไว้อยู่ภายใน the FreeRTOS/Demo/common directory tree. เมื่อคุณเอาออก
        a demo application file จากการบิวด์คุณจะต้องเอาออก the call ภายใน main() ที่ใช้สร้าง the tasks ที่ไม่ได้ included อีกต่อไปด้วย.