ZoLArk173
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Setup and Compile FreeRTOS for Raspberry Pi Pico Following guide is tested with Raspberry Pi Pico W. 1. Clone FreeRTOS source ``` shell git clone https://github.com/FreeRTOS/FreeRTOS-Kernel.git cd FreeRTOS-Kernel git submodule update --init ``` 2. Use official Raspberry Pi Pico VSCode extension to create a project. When creating the project, choose **the correct board type** and check `Console over USB` if you want to use UART over USB. 3. Navigate to [FreeRTOS-Kernel/RP2040](https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/main/portable/ThirdParty/GCC/RP2040), download `FreeRTOS_Kernel_import.cmake` and place in the root of the project. 4. Insert following block into `CMakeLists.txt` just below `pico_sdk_init()`. ``` cmake # Tell FreeRTOS which port (RP2040) and heap to use set(FREERTOS_PORT GCC_RP2040 CACHE STRING "") set(FREERTOS_HEAP 4 CACHE STRING "") # Point the import script at your kernel checkout set(FREERTOS_KERNEL_PATH "/home/hyy/Documents/pico/FreeRTOS-Kernel" CACHE PATH "") # NEW: define where FreeRTOSConfig.h is add_library(freertos_config INTERFACE) target_include_directories(freertos_config SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR} ) include(FreeRTOS_Kernel_import.cmake) ``` - Modify `FREERTOS_KERNEL_PATH` to your actual path to FreeRTOS-Kernel folder. 5. Add `FreeRTOS-Kernel` and `FreeRTOS-Kernel-Heap4` to `target_link_libraries()` in `CMakeLists.txt` ``` cmake # Add any user requested libraries target_link_libraries(rtos_example pico_stdlib pico_cyw43_arch_none FreeRTOS-Kernel FreeRTOS-Kernel-Heap4 ) ``` 6. Place `FreeRTOSConfig.h` under the root of the project. Example for Pico W: ``` c #pragma once /* ====== Core kernel features ====== */ #define configUSE_PREEMPTION 1 #define configUSE_TIME_SLICING 1 #define configUSE_IDLE_HOOK 0 #define configUSE_TICK_HOOK 0 #define configCPU_CLOCK_HZ ( 125000000UL ) /* default Pico clock */ #define configTICK_RATE_HZ ( 1000 ) #define configMAX_PRIORITIES ( 7 ) #define configMINIMAL_STACK_SIZE ( 256 ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 64 * 1024 ) ) /* heap_4 */ /* ====== SMP on RP2040 (2 cores) ====== */ #define configNUMBER_OF_CORES 2 #define configRUN_MULTIPLE_PRIORITIES 1 /* ====== Queues/semaphores/timers ====== */ #define configUSE_16_BIT_TICKS 0 #define configUSE_MUTEXES 1 #define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_COUNTING_SEMAPHORES 1 #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) #define configTIMER_QUEUE_LENGTH 10 #define configTIMER_TASK_STACK_DEPTH ( 1024 ) /* ====== API functions we want ====== */ #define INCLUDE_vTaskDelay 1 #define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelete 1 #define INCLUDE_xTaskGetCurrentTaskHandle 1 #define INCLUDE_xTaskGetIdleTaskHandle 1 #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_xTimerPendFunctionCall 1 /* ====== Interrupt priorities (Cortex-M0+) ====== */ #define configPRIO_BITS 2 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 3 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1 #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) /* ====== Assert hook to help debugging ====== */ void vAssertCalled( const char * file, int line ); #define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled(__FILE__, __LINE__) #define configUSE_PASSIVE_IDLE_HOOK 0 #define configUSE_CORE_AFFINITY 1 ``` 7. Edit the main c file to run FreeRTOS. Example for Pico W: ``` c #include <stdio.h> #include "pico/stdlib.h" #include "FreeRTOS.h" #include "task.h" #include "pico/cyw43_arch.h" /* Assert handler declared in FreeRTOSConfig.h */ void vAssertCalled(const char* file, int line) { // Print to USB-CDC if enabled; then halt printf("ASSERT: %s:%d\n", file, line); taskDISABLE_INTERRUPTS(); for(;;); } // Perform initialisation int pico_led_init(void) { #if defined(PICO_DEFAULT_LED_PIN) // A device like Pico that uses a GPIO for the LED will define PICO_DEFAULT_LED_PIN // so we can use normal GPIO functionality to turn the led on and off gpio_init(PICO_DEFAULT_LED_PIN); gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT); return PICO_OK; #elif defined(CYW43_WL_GPIO_LED_PIN) // For Pico W devices we need to initialise the driver etc return cyw43_arch_init(); #endif } // Turn the led on or off void pico_set_led(bool led_on) { #if defined(PICO_DEFAULT_LED_PIN) // Just set the GPIO on or off gpio_put(PICO_DEFAULT_LED_PIN, led_on); #elif defined(CYW43_WL_GPIO_LED_PIN) // Ask the wifi "driver" to set the GPIO on or off cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_on); #endif } static void vBlinkTask(void *pv) { int rc = pico_led_init(); hard_assert(rc == PICO_OK); while (1) { pico_set_led(true); vTaskDelay(pdMS_TO_TICKS(250)); pico_set_led(false); vTaskDelay(pdMS_TO_TICKS(250)); } } static void vHelloTask(void *pv) { while (1) { printf("Hello from FreeRTOS on core %d!\n", get_core_num()); vTaskDelay(pdMS_TO_TICKS(1000)); } } static void vHelloTask2(void *pv) { while (1) { printf("Hello from FreeRTOS on core %d!\n", get_core_num()); vTaskDelay(pdMS_TO_TICKS(1000)); } } int main(void) { const UBaseType_t core0_mask = 1 << 0; // core 0 const UBaseType_t core1_mask = 1 << 1; // core stdio_init_all(); // enable printf over USB (you already turned on USB stdio in CMake) xTaskCreate(vBlinkTask, "blink", 512, NULL, tskIDLE_PRIORITY + 1, NULL); xTaskCreateAffinitySet(vHelloTask, "hello", 512, NULL, tskIDLE_PRIORITY + 1, core0_mask, NULL); xTaskCreateAffinitySet(vHelloTask2, "hello2", 512, NULL, tskIDLE_PRIORITY + 1, core1_mask, NULL); vTaskStartScheduler(); // hands control to FreeRTOS (never returns) for(;;); // safety } ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully