nRF52 FreeRTOS LEDBlink

Sysprogs forums Forums VisualGDB nRF52 FreeRTOS LEDBlink

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8444
    Brian Walker
    Participant

    The Nordic SDK for the nRF52 includes a Blinky example using FreeRTOS.  VisualGDB includes FreeRTOS examples for other platforms, but no option exists for the nRF52 when generating a new project.  Can one be created?

    My attempt to shoehorn FreeRTOS in has resulted in a large list of includes (which defeats the purpose of a managed build) and multiple definitions of parts of the project that are managed by the build.

    #8445
    support
    Keymaster

    Hi,

    We are considering it for the next update of our nRF52 BSP, but it’s not there yet. However we can easily help you get through the errors you are encountering if you share more details.

    #8453
    Brian Walker
    Participant

    I may have made some “progress” since the original post, so here is what I’ve done.

     

    I started an nRF52 blinky (BSP) demo.

    (I’ve installed my shared files at the same root directory as my project, so that why the pathing may appear odd.)

    Per the standard FreeRTOS setup, I added the following include directories:

    ../../bsp/nRF5x/external/freertos/source/include

    ../../bsp/nRF5x/external/freertos/portable/GCC/nrf52

     

    Per the standard FreeRTOS setup, I added the following files to my project from the bsp install:

    ../../bsp/nRF5x/external/freertos/source/list.c

    ../../bsp/nRF5x/external/freertos/source/queue.c

    ../../bsp/nRF5x/external/freertos/source/tasks.c

    ../../bsp/nRF5x/external/freertos/source/portable/MemMang/heap_1.c

    ../../bsp/nRF5x/external/freertos/portable/GCC/nrf52/port.c

     

    I also copied FreeRTOSConfig.h to my project and added it as a header file.  I modified the file to match the config from blinky_freertos in the SDK.

     

    I added the following includes to my LEDBlink.c and then built.  (No actual FreeRTOS tasks.)
    #include “FreeRTOS.h”
    #include “task.h”

     

    This produced multiple build errors for portmacro_cmsis.h so I added the following include directory to the makefile.

    ../../bsp/nRF5x/external/freertos/portable/CMSIS/nrf52

    This built cleanly.

     

    I then created a task and added a call to vTaskStartScheduler().

    This build failed.

    I added the following sources to resolve missing file errors.

    ../../bsp/nRF5x/external/freertos/portable/CMSIS/nrf52/port_cmsis.c

    ../../bsp/nRF5x/external/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c

     

    This build failed with the following errors:

    Severity    Code    Description    Project    File    Line    Suppression State
    Error    VGDB1000    undefined reference to ‘nrf_drv_clock_lfclk_request’    blink_freertos    C:\Projects\nordic\visualgdb\bsp\nRF5x\external\freertos\portable\CMSIS\nrf52\port_cmsis_systick.c    200
    Error    VGDB1002    undefined reference to ‘__isr_vector’    blink_freertos    C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\port.c    1
    Error    VGDB1000    undefined reference to ‘xTimerCreateTimerTask’    blink_freertos    C:\Projects\nordic\visualgdb\bsp\nRF5x\external\freertos\source\tasks.c    1565
    Error        ld returned 1 exit status    blink_freertos    C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\collect2.exe    1
    Error        Command-line action failed    blink_freertos    C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\VisualGDB    1
    Error    MSB3073    The command “”C:\Program Files (x86)\Sysprogs\VisualGDB\\VisualGDB.exe” /rebuild “C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\blink_freertos.vcxproj” “/solution:C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos.sln” “/config:Debug” “/platform:Win32″” exited with code 1.    blink_freertos    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets    42

     

    Clearly these are all linker errors, and that’s where I’m at.

    • This reply was modified 7 years, 11 months ago by Brian Walker.
    • This reply was modified 7 years, 11 months ago by Brian Walker.
    #8456
    Brian Walker
    Participant

    I enabled the clock and added the following file:

    ../../bsp/nRF5x/external/freertos/source/timers.c

     

    That leaves me with:

    Severity    Code    Description    Project    File    Line    Suppression State
    Error    MSB3073    The command “”C:\Program Files (x86)\Sysprogs\VisualGDB\\VisualGDB.exe” /rebuild “C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\blink_freertos.vcxproj” “/solution:C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos.sln” “/config:Debug” “/platform:Win32″” exited with code 1.    blink_freertos    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets    42
    Error    VGDB1002    undefined reference to ‘__isr_vector’    blink_freertos    C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\port.c    1
    Error        ld returned 1 exit status    blink_freertos    C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\collect2.exe    1
    Error        Command-line action failed    blink_freertos    C:\Projects\nordic\visualgdb\blink_freertos\blink_freertos\VisualGDB    1

     

    #8457
    support
    Keymaster

    Hi,

    This happens because the FreeRTOS port hardcodes the ISR vector table name variable name as ‘__isr_vector’ and the VisualGDB startup file uses a different name.

    The easiest way to solve this is to replace this (in port.c):

        "   ldr r0, =__isr_vector     \n" /* Locate the stack using __isr_vector table. */
        "   ldr r0, [r0]              \n"

    with that:

    "   ldr r0, =_estack     \n"

    Note that the “ldr ro, [r0]” line will be removed, as _estack already contains the end-of-stack address.

    Let us know if you encounter further problems.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.