Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with updated 'develop' branch #38

Closed
1 task
loboris opened this issue Feb 13, 2019 · 5 comments
Closed
1 task

Issues with updated 'develop' branch #38

loboris opened this issue Feb 13, 2019 · 5 comments
Labels
area-kernel bug Something isn't working

Comments

@loboris
Copy link

loboris commented Feb 13, 2019

Make sure you read and understand this document.
Use one of the two templates below and delete the rest.

  • BUG REPORT

Expected behavior

Expected to build and run without issues.

Actual behavior

Does not build.
Does not run with two processors.

Test code

#include <stdio.h>
#include <string.h>
#include <FreeRTOS.h>
#include <task.h>
#include <semphr.h>

static TaskHandle_t test_handle0 = 0;
static TaskHandle_t test_handle1 = 0;
static SemaphoreHandle_t test_task_mutex = NULL;

//---------------------------------------
static void test_task0(void *pvParameter)
{
    uint64_t n = 0, ticks;
    while (1) {
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        n++;
        ticks = xTaskGetTickCount();
        if (xSemaphoreTake( test_task_mutex, 100) == pdTRUE ) {
            printf("Task at 0: %lu, %lu\n", n, ticks);
            xSemaphoreGive(test_task_mutex);
        }
    }
    vTaskDelete(NULL);
}

//----------------------------------------
static void test_task1(void *pvParameter)
{
    uint64_t n = 0, ticks;
    while (1) {
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        n++;
        ticks = xTaskGetTickCount();
        if (xSemaphoreTake( test_task_mutex, 100) == pdTRUE ) {
            printf("Task at 1: %lu, %lu\n", n, ticks);
            xSemaphoreGive(test_task_mutex);
        }
    }
    vTaskDelete(NULL);
}

//------------
int main(void)
{
    printf("TEST\n");

    test_task_mutex = xSemaphoreCreateMutex();
    configASSERT(test_task_mutex);

    xTaskCreateAtProcessor(
            0,                          // processor
            test_task0,                 // function entry
            "TASK0",                    // task name
            configMINIMAL_STACK_SIZE,   // stack_deepth
            NULL,                       // function argument
            1,                          // task priority
            &test_handle0);             // task handle
    configASSERT(test_handle0);

    vTaskDelay(500 / portTICK_PERIOD_MS);
    xTaskCreateAtProcessor(
            1,                           // processor
            test_task1,                  // function entry
            "TASK1",                     // task name
            configMINIMAL_STACK_SIZE,    // stack_deepth
            NULL,                        // function argument
            1,                           // task priority
            &test_handle1);              // task handle
    configASSERT(test_handle1);

    while (1) {
        vTaskDelay(200);
    }
}

Document version

develop, 8f14b9d

Hardware

Sipeed MAIX-Bit, Dan-Dock

System

Ubuntu 18.04


During build, an error is reported:

-- Configuring done
-- Generating done
-- Build files have been written to: /home/LoBo2_Razno/MAIX/TEST/freertos-test/build
Scanning dependencies of target lwipcore
[  1%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/init.c.obj
cc1: error: requested ABI requires -march to subsume the 'D' extension
third_party/lwip/CMakeFiles/lwipcore.dir/build.make:62: recipe for target 'third_party/lwip/CMakeFiles/lwipcore.dir/src/core/init.c.obj' failed
make[2]: *** [third_party/lwip/CMakeFiles/lwipcore.dir/src/core/init.c.obj] Error 1
CMakeFiles/Makefile2:520: recipe for target 'third_party/lwip/CMakeFiles/lwipcore.dir/all' failed
make[1]: *** [third_party/lwip/CMakeFiles/lwipcore.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

This can be solved by changing the line in cmake/compile-flags.cmake to -march=rv64imafdc


When successfully compiled, only the task on processor 0 is running:

TEST
Task at 0: 1, 101
Task at 0: 2, 201
Task at 0: 3, 301
Task at 0: 4, 401
Task at 0: 5, 501
Task at 0: 6, 601
Task at 0: 7, 701
Task at 0: 8, 801
Task at 0: 9, 901
Task at 0: 10, 1001
Task at 0: 11, 1101

If compiled with master branch, tasks on both processors are running:

TEST
Task at 0: 1, 100
Task at 1: 1, 150
Task at 0: 2, 200
Task at 1: 2, 250
Task at 0: 3, 300
Task at 1: 3, 350
Task at 0: 4, 400
Task at 1: 4, 450
Task at 0: 5, 500
Task at 1: 5, 550
Task at 0: 6, 600
Task at 1: 6, 650
Task at 0: 7, 700
Task at 1: 7, 750
Task at 0: 8, 800
Task at 1: 8, 850
Task at 0: 9, 900
Task at 1: 9, 950
Task at 0: 10, 1000
Task at 1: 10, 1050
Task at 0: 11, 1100
Task at 1: 11, 1150
@loboris
Copy link
Author

loboris commented Feb 13, 2019

If this line in 'os_entry.c' is uncommented, the application freezes on start, unless a small delay is added at the beginning of the main() (vTaskDelay(10 / portTICK_PERIOD_MS);).
Still, only the task on processor 0 is running.

@sunnycase
Copy link
Member

Should be fixed in e4bd4cc. Additionally you need to use the latest toolchain with the SDK in develop branch.

@sunnycase sunnycase added bug Something isn't working area-kernel labels Feb 14, 2019
@loboris
Copy link
Author

loboris commented Feb 14, 2019

Thanks, it works now.

What about the error in lwipcore requiring D extension?
cc1: error: requested ABI requires -march to subsume the 'D' extension

Scanning dependencies of target lwipcore
[  1%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/init.c.obj
cc1: error: requested ABI requires -march to subsume the 'D' extension
third_party/lwip/CMakeFiles/lwipcore.dir/build.make:62: recipe for target 'third_party/lwip/CMakeFiles/lwipcore.dir/src/core/init.c.obj' failed

Is it ok to change -march=rv64imafc to -march=rv64imafdc in cmake/compile-flags.cmake ?
It works but I'm not shure if there is any consequence.

I'm using the latest toolchain https://github.com/kendryte/kendryte-gnu-toolchain/releases/tag/v8.2.0-20190221

@loboris loboris changed the title Issuues with updated 'develop' branch Issues with updated 'develop' branch Feb 14, 2019
@sunnycase
Copy link
Member

@loboris
Copy link
Author

loboris commented Feb 14, 2019

Thank you, all works with that toolchain version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-kernel bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants