Git Product home page Git Product logo

kendryte-freertos-sdk's People

Contributors

gongt avatar ly0 avatar sunnycase avatar vowstar avatar xiangbingj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kendryte-freertos-sdk's Issues

can't link hard-float modules with soft-float modules2

This problem occurred when i run ’ tflite_label_image‘ demo ,
Here are the steps
1、creating libtensorflow-lite.a ; Use ' sh build_kendryte_lib.sh' command in /kendryte-tensorflow/tensorflow/lite/tools/make folder
2、New shared folder in kendryte-freertos-sdk/src then copy libtensorflow-lite.a to it
3、run cmake .. -DPROJ=tflite_label_image -DTOOLCHAIN=/opt/kendryte-toolchain/bin && make in build folder
How to solve it ?or there is something wrong with my method.

Missing functions


FEATURE REQUEST

Missing feature

Some FreeRTOS functions are still not prepared for use with two processors.
For example, configGENERATE_RUN_TIME_STATS cannot be enabled and all runtime statistics related functions are not available.

Justification

All FreeRTOS functionality should be available for K210 port.
Many of the missing functions are used quite often and it shouldn't be too hard to implement the missing functionality.

Workarounds

No workarounds as far as I can see.
As an example of FreeRTOS implementation fo two cores the esp-idf FreeRTOS port could be useful.

Build bin file issue

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

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

Actual behavior

Test code

Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.

# Add code here

Document version

Which branch are you on? If you know the Git revision then add it here as well.

Hardware

Which hardware do you use?

System

What system do you use?


FEATURE REQUEST

Missing feature

Justification

Tell us why you would like to see this feature added.

Workarounds

Are there any workarounds you currently have in place because the feature is missing?

Issue with updated develop branch

Hi All,
I've downloaded this and tried to conpile hello_world project but I am getting bunch of errors, I should mention that I haven't had issue prior to updating my SDK. Here is one of the errors:

/opt/kendryte-toolchain/lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: CMakeFiles/hello_world.dir/src/hello_world/main.c.obj: can't link hard-float modules with soft-float modules

kpu.cpp 3 Layer Type missed!

BUG REPORT
A framework-kendryte-standalone-sdk\lib\drivers\kpu.c has 22 kind of layer type.
but framework-kendryte-freertos-sdk\lib\bsp\device\kpu.cpp has 19 kind of layer type.

KL_QUANTIZED_RESIZE_NEAREST_NEIGHBOR
KL_CHANNELWISE_DEQUANTIZE
KL_LOGISTIC
are missed!

I would like to try YOLO-V3 on freetros.
https://github.com/zhen8838/k210-yolo3

But,l get error.
assertion "!"Layer is not supported."" failed: file "C:\Users\xxx.platformio\packages\framework-kendryte-freertos-sdk\lib\bsp\device\kpu.cpp", line 1018, function: int k_kpu_driver::ai_step()
W (1001447362) SYSCALL: sys_exit called with 0x1

Could you add 3 Layer to kpu.cpp.

Build env.
Windows 10
PlarformIO IDE

platformio.ini
[env:sipeed-maix-bit-mic]
platform = kendryte210
board = sipeed-maix-bit-mic
framework = kendryte-freertos-sdk

Board
Sipeed MAix Bit with Mic

k210-yolo3 on C:\Users\xxx.platformio\packages\framework-kendryte-standalone-sdk
is no problem.

I convert k210-yolo3 stand-alone code to kendryte-freertos-sdk code.
and run.
I got error above.

Hardware

Sipeed MAix Bit with Mic

System

What system do you use?
Windows10
platformio IDE
C:\Users\nishi.platformio\packages\framework-kendryte-freertos-sdk

Thank You!

compiling issue

I am relative new to RTOS and Linux.
I am using Linux and when I enter "cmake .. -DPROJ= -DTOOLCHAIN=/opt/riscv-toolchain/bin && make" to compile I get an error "bash: main: No such file or directory".

Thank you.

handle misaligned load/store

Missing feature

handle misaligned load/store & report error message

Justification

add handler for misaligned load/store

Workarounds

no

vApplicationIdleHook() cannot be overridden.

  • [x ] BUG REPORT

The vApplicationIdleHook() is defined in freertos/lib/osentry.c as

void vApplicationIdleHook(void)
{
}

better code would be

#if ( configUSE_IDLE_HOOK == 1 )
void __attribute__((weak)) vApplicationIdleHook(void)
{
}
#endif /* configUSE_IDLE_HOOK */

as this would allow the application to implement the hook and it would not define the hook unless it is needed. I have tested this and it works well.

I2S SCLK Setting sometime may fail?


BUG REPORT

Expected behavior

In order to set I2S2 WS to 48KHz, SCLK to 3.072MHz, I Set the PLL2 Clock to 36864000Hz.

Actual behavior

The returned PLL2 clock is 36833333Hz, however WS is about 57.5kHz, it looks like the i2s.c driver is not correct.

Test code

Since the acutal clock of PLL2 cannot perfectly match the setting value. When the actual value is less than the setting value. The equation may get wrong result.
*threshold = pll2_clock / (format->sample_rate * 128) - 1;
We need to use float math function to get closer result.
*threshold = round(1.0f * pll2_clock / (format->sample_rate * 128) - 1);

The code in I2S.c:
static void extract_params(const audio_format_t *format, uint32_t *threshold, i2s_word_select_cycles_t *wsc, i2s_word_length_t *wlen, size_t *block_align, uint32_t *dma_divide16)
{
uint32_t pll2_clock = 0;
pll2_clock = sysctl_pll_get_freq(SYSCTL_PLL2);
configASSERT((format->sample_rate > pll2_clock / (1 << 23)) && (format->sample_rate < pll2_clock / (1 << 7)));
switch (format->bits_per_sample)
{
case 16:
*wsc = SCLK_CYCLES_32;
*wlen = RESOLUTION_16_BIT;
*block_align = format->channels * 2;
*dma_divide16 = 1;
break;
case 24:
*wsc = SCLK_CYCLES_32;
*wlen = RESOLUTION_24_BIT;
*block_align = format->channels * 4;
*dma_divide16 = 0;
break;
case 32:
*wsc = SCLK_CYCLES_32;
*wlen = RESOLUTION_32_BIT;
*block_align = format->channels * 4;
*dma_divide16 = 0;
break;
default:
configASSERT(!"Invlid bits per sample");
break;
}
// Fix Bug since the actual pll is not equal to set value. 2018/10/19
#if 0
*threshold = pll2_clock / (format->sample_rate * 128) - 1;
#else
*threshold = round(1.0f * pll2_clock / (format->sample_rate * 128) - 1);
#endif
}

Exceptions not working

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

Should be able to obtain multiple dma handles at the same time (as used in fft.cpp).

Actual behavior

Code crashes on attempting to obtain second handle. Root cause is that exceptions do not work .

Test code

extern int dma_open_free();

int main(void)
{
        uintptr_t dma_write = dma_open_free();
        uintptr_t dma_read = dma_open_free();

    while (1)
        ;
    return 0;
}

Specific exception handling test available here: https://gitlab.com/nemach-embedded/maix-pio-exceptions

Document version

commit 45a5b64 (HEAD -> develop, origin/develop, origin/HEAD)

Hardware

MAIX Dock One

System

Windows 10

ov5640?what is the purpose?

I just wonder why do you support ov5640 5MP pixels sensor while this board only support 320x240 image? what is the purpose of this? is there a way to get a 320x240 ROI of the whole 5MP image from sensor like sliding window?
Obviously you can't do that so I switch to other board vendor. Just wasted my time and money for nothing
Thanks

lvgl macro and sub directory support

Hi All, I am trying to add lvgl to the lcd project but it gives me some errors (#include ../../lv_conf.h No such file or directory) , I should mention that it is ok with kendryte-standalone-sdk. Also I have issue adding sub folder and libraries into the project in general.

FreeRTOS port up to date

Why freeRTOS are not supported anymore ?

I want to use a rtos on k210.
And possibly for product development.

What rtos are supported by kendryte k210 now ?

"[warning]This project is no longer maintained.Not recommended for product development."

UART DMA

I am using the UART port and I've noticed that sometimes it misses some of the data especially when multiple task is running and when a task is waiting for an event and it receives the event.
I noticed that you have created UART dma branch, any plan to merge that with the latest develop branch?

xQueueSend between tasks on different processors


  • BUG REPORT

Expected behavior

Sending message with xQueueSend between tasks running on different processors should work.

Actual behavior

Task 1, running on processor #0 sends to the queue with xQueueSend
Task 2, running on processor #1 receives from the queue with xQueueReceive


After task1 sends the message, task2 switches to processor 0 and continues to run on it.


The source of the bug is probably in queue.c in a way the xTaskRemoveFromEventList function is used.

There is quite large amount of other FreeRTOS functions which are not prepared for dual processor usage and can present a big issue if/when used.
This should be addressed as soon as possible!


Test code

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

typedef struct _msg_t {
    uint32_t id;
    char strdata[256];
} msg_t;

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

static QueueHandle_t queue;

//---------------------------------------
static void test_task0(void *pvParameter)
{
    uint64_t n = 0, ticks;
    float x;
    msg_t message = { 0 };
    while (1) {
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        n++;
        ticks = xTaskGetTickCount();
        x = (float)ticks / 1.23456789;
        if (xSemaphoreTake( test_task_mutex, 100) == pdTRUE ) {
            printf("Task0 at %lu: %lu, %lu, %.3f\n", uxPortGetProcessorId(), n, ticks, x);
            xSemaphoreGive(test_task_mutex);
        }
        if ((n % 4) == 0) {
            if (xSemaphoreTake( test_task_mutex, 100) == pdTRUE ) {
                printf("Sending message to task1\n");
                xSemaphoreGive(test_task_mutex);
            }
            message.id = n;
            sprintf(message.strdata, "From task 0, ticks=%lu", ticks);
            if (xQueueSend(queue, (void *)&message, 0) != pdTRUE) {
                if (xSemaphoreTake( test_task_mutex, 100) == pdTRUE ) {
                    printf("Send message failed\n");
                    xSemaphoreGive(test_task_mutex);
                }
            }
        }
    }
    vTaskDelete(NULL);
}

//----------------------------------------
static void test_task1(void *pvParameter)
{
    uint64_t n = 0, ticks;
    float x;
    msg_t message = { 0 };
    while (1) {
        if (xQueueReceive(queue, (void *)&message, 1000 / portTICK_PERIOD_MS) == pdTRUE) {
            if (xSemaphoreTake( test_task_mutex, 100) == pdTRUE ) {
                printf("Message received: id=%u, msg='%s'\n", message.id, message.strdata);
                xSemaphoreGive(test_task_mutex);
            }
        }
        //vTaskDelay(1000 / portTICK_PERIOD_MS);
        n++;
        ticks = xTaskGetTickCount();
        x = (float)ticks / 1.23456789;
        if (xSemaphoreTake( test_task_mutex, 100) == pdTRUE ) {
            printf("Task1 at %lu: %lu, %lu, %.3f\n", uxPortGetProcessorId(), n, ticks, x);
            xSemaphoreGive(test_task_mutex);
        }
    }
    vTaskDelete(NULL);
}

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

    queue = xQueueCreate(4, sizeof(msg_t) );
    configASSERT(queue);

    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);

    int cnt = 0;
    while (1) {
        vTaskDelay(1000);
        cnt++;
    }
}

SDK version

develop, 68b5563
Kendryte GNU Toolchain v8.2.0-20190213

Hardware

Sipeed MAIX-Bit, Dan-Dock

System

Ubuntu 18.04


Output produced by the test program:

Before the first xQueueSend task1 runs on processor #1.
After xQueueSend it runs on processor #0.
There is no 50 ticks difference between tasks ticks any more, which proves that the tasks actually runs on the same processor.

TEST
Task0 at 0: 1, 101, 81.810
Task1 at 1: 1, 152, 123.120
Task0 at 0: 2, 201, 162.810
Task1 at 1: 2, 252, 204.120
Task0 at 0: 3, 301, 243.810
Task1 at 1: 3, 352, 285.120
Task0 at 0: 4, 401, 324.810
Sending message to task1
Message received: id=4, msg='From task 0, ticks=401'
Task1 at 0: 4, 401, 324.810
Task0 at 0: 5, 501, 405.810
Task1 at 0: 5, 502, 406.620
Task0 at 0: 6, 601, 486.810
Task1 at 0: 6, 602, 487.620
Task0 at 0: 7, 701, 567.810
Task1 at 0: 7, 702, 568.620
Task0 at 0: 8, 801, 648.810
Sending message to task1
Message received: id=8, msg='From task 0, ticks=801'
Task1 at 0: 8, 801, 648.810
Task0 at 0: 9, 901, 729.810
Task1 at 0: 9, 902, 730.620
Task0 at 0: 10, 1001, 810.810
Task1 at 0: 10, 1002, 811.620
Task0 at 0: 11, 1101, 891.810
Task1 at 0: 11, 1102, 892.620
Task0 at 0: 12, 1201, 972.810

E (47408858) FreeRTOS: (kendryte-freertos-sdk/lib/drivers/src/network/dm9051.cpp:255) value == 0x90510a46

I'm using the lastest everything (toolchain/SDK/demo), and am getting an error when trying to run the tcp_server example.

E (47408858) FreeRTOS: (/Users/nalzok/Developer/kendryte-freertos-sdk/lib/drivers/src/network/dm9051.cpp:255) value == 0x90510a46

I guess it has something to do with this assert.

virtual void on_first_open() override
{
auto spi = make_accessor(spi_driver_);
spi_dev_ = make_accessor(spi->get_device(SPI_MODE_0, SPI_FF_STANDARD, spi_cs_mask_, 8));
spi_dev_->set_clock_rate(20000000);
int_gpio_ = make_accessor(int_gpio_driver_);
int_gpio_->set_drive_mode(int_gpio_pin_, GPIO_DM_INPUT);
int_gpio_->set_pin_edge(int_gpio_pin_, GPIO_PE_FALLING);
int_gpio_->set_on_changed(int_gpio_pin_, (gpio_on_changed_t)isr_handle, this);
uint32_t value = 0;
/* Read DM9051 PID / VID, Check MCU SPI Setting correct */
value |= (uint32_t)read(DM9051_VIDL);
value |= (uint32_t)read(DM9051_VIDH) << 8;
value |= (uint32_t)read(DM9051_PIDL) << 16;
value |= (uint32_t)read(DM9051_PIDH) << 24;
configASSERT(value == 0x90510a46);
}

By the way, I'm completely lost on what that example is doing. That a few lines doesn't count as documentation IMO. Please explain it in detail. Thanks.

FreeRTOS not possible to load models kmodel

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Hi friend, @sunnycase

Expected behavior

Load yolo.kmodel in FreeRTOS with function kpu_model_load_from_buffer
It seems to be that in standalone it is possible with function:
INCBIN(model, "yolo.kmodel");
kpu_model_context_t task;
kpu_load_kmodel(&task, model_data)

But this functions are not supported in FreeRTOS, so do you know what is the problem?

Thanks in advance.

Actual behavior

It is possible to load detect.kmodel with:
INCBIN(model, "../src/kfpkg_face_detect/detect.kmodel");
uint8_t *model_data_align = model_data;
model_context = kpu_model_load_from_buffer(model_data_align);

But when I try to load yolo model or other models from:
INCBIN(model, "../src/kfpkg_20class/yolo.kmodel");
INCBIN(model, "../src/kfpkg_fast_facedetect/slim-320.kmodel");
INCBIN(model, "../src/kfpkg_iris/iris.kmodel");
INCBIN(model, "../src/kfpkg_ulffd_landmark/ulffd_landmark.kmodel");
INCBIN(model, "../src/kfpkg_yolox/yolox_nano_224.kmodel");

I received in runtime the following error when try to load model with kpu_model_load_from_buffer function:
terminate called after throwing an instance of 'std::runtime_error'
what(): Cannot load kmodel.
W (685254006) SYSCALL: sys_exit called with 0x1

So, if it is not possible to run kmodel, why do you implement s FreeRTOS SDK?
How do you implement detect.kmodel? Are there any documents?

Document version

SDK:
https://github.com/kendryte/kendryte-freertos-sdk

Toolchain:
https://github.com/kendryte/kendryte-gnu-toolchain

Hardware

Sipeed maix bit with microphone

System

Windows 10
PlatformIO

i2c is halted once there is no slave device

Hi All,

I have set i2c in master mode, where slave device is connected it works fine but if I disconnect the slave device and try to read from i2c, it stays in i2c_dev_transfert_sequential forever while I expect that it exits with an error, looks like there is no timeout in case of error.

A way to unmount SD Cards and handle failed initialization

  • [ ] BUG REPORT
  • [ X ] FEATURE REQUEST

FEATURE REQUEST

Missing feature

A way to handle failed SD Card initialization and unmount the SD Card when using sdcard.h.
If for example I try to initialize the SD card without the SD Card plugged in, if will fail and halt the program instead of giving me a null handle for the SD Card driver. There is also no way to unmount a SD Card and remove the driver.

Justification

The current way makes (in my opinion) sdcard.h not suitable for applications where the SD Card is not strictly needed and might even be removed after unmounting it.

Workarounds

Pretty much nothing. Other than not using the builtin sd driver and filesystem there isn't much.
The on_first_open method in sdcard.cpp uses a FreeRTOS assert with locks up as soon as the initialization fails. And unmount is currently only supported in the third party fat library.

Kendryte GNU toolchain for Macox

BUG REPORT

I tried building GNU RISC-V tool chain following the commands listed in README.

git clone --recursive https://github.com/kendryte/kendryte-gnu-toolchain
./configure --prefix=/usr/local/opt/kendryte-toolchain --with-cmodel=medany --with-arch=rv64imafc --with-abi=lp64f
make -j8

However This was not created at all.
kendryte-gnu-toolchain/riscv-toolchain/bin/riscv64-unknown-elf-gcc: No such file or directory

Hardware: Macbook. MacOS


UART sending data shorter than 17 bytes wont work

I feel like, because few weeks ago i wrote example to communicate k210 over UART with esp32 on maixduino board, but today i found that sending data shorter than 17 bytes wont work(i feel like, because my test string is exactly 17 bytes):
https://github.com/chegewara/sipeed-maixduino-test-apps/tree/master/platformIO/freertos/uart-to-esp32

Now anything shorter just is not printed in esp32 console.
I cant say for sure its kendryte issue, but i didnt see anything like that on esp32.

EDIT sending data from esp32 to k210 is not a problem, i can send 1+ bytes

can not compile, missing encoding.h

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

  • [ *] BUG REPORT
  • FEATURE REQUEST

BUG REPORT

Expected behavior

Actual behavior

-- Configuring done
-- Generating done
-- Build files have been written to: /home/pl/Downloads/tmp/freertos-test/build
Scanning dependencies of target drivers
[ 2%] Building C object lib/drivers/CMakeFiles/drivers.dir/clint.c.obj
/home/pl/Downloads/tmp/kendryte-freertos-sdk/lib/drivers/clint.c:15:10: fatal error: encoding.h: No such file or directory
#include <encoding.h>
^~~~~~~~~~~~
compilation terminated.

Test code

Provide a Minimal, Complete, and Verifiable example which will reproduce the problem.

# Add code here

Document version

Which branch are you on? If you know the Git revision then add it here as well.

Hardware

Which hardware do you use?

System

What system do you use?


FEATURE REQUEST

Missing feature

Justification

Tell us why you would like to see this feature added.

Workarounds

Are there any workarounds you currently have in place because the feature is missing?

关于Global Pointer问题

RISC V的全局指针在linker里面是一个特殊的字符,应该为__global_pointer$,这个是linker决定的,目前linker脚本给的是_gp,此指针主要用于优化全局变量的操作;
这里crt.S

  la gp, _gp

和kendryte.ld

  .data :
  {
    /* Writable data segment (.data segment) */
    *(.data .data.*)
    *(.gnu.linkonce.d.*)
    /* Have _gp point to middle of sdata/sbss to maximize displacement range */
    . = ALIGN(8);
    PROVIDE( _gp = ABSOLUTE(.) + 0x800);

可以同步下.

[FEATURE REQUEST] build projects outside of sdk

hello,
i noticed building projects outside the sdk directory didnt work for me
because the third_party sources were not added correctly.

here is the diff to make it work:

diff --git a/cmake/executable.cmake b/cmake/executable.cmake
index c66d340..b91ed3e 100644
--- a/cmake/executable.cmake
+++ b/cmake/executable.cmake
@@ -10,6 +10,7 @@ if (NOT BUILDING_SDK)
         ### source code sdk
         include_directories(${SDK_ROOT}/lib/arch/include ${SDK_ROOT}/lib/utils/include)
         add_subdirectory(${SDK_ROOT}/lib SDK)
+        add_subdirectory(${SDK_ROOT}/third_party THIRD_PARTY)
     endif()
 endif ()

also, to be more consistent i modified the CMakeLists.txt.example.cmake like so:

cmake_minimum_required(VERSION 3.0)

## Required Variable: (if you do not use Kendryte IDE)
# -DTOOLCHAIN=/path/to/rsicv/toolchain/bin
# -DSDK=/path/to/SDK (the folder of this example file)

## Include the SDK library
include("${SDK_ROOT}/cmake/common.cmake")

# add sources for project
add_source_files(
    "src/${PROJ}/*.c"
    "src/${PROJ}/*.s"
    "src/${PROJ}/*.S"
    "src/${PROJ}/*.cpp"
    )

## Use SDK builder to build this project
include("${SDK_ROOT}/cmake/executable.cmake")

would be nice if you could merge these changes some time.
cheers!

i2c slave bug


BUG REPORT

Actual behavior

i2c slave mode work failed. Need clear the RD_REQ interrupt.

size limitation in filesystem_file_read?

Hi All,
I am trying to read a file ( file size is 300kb) from sdcard using filesystem_file_read function. I tried to read in 1000bytes blocks but it doesn't work properly and after reading some blocks it doesn't respond anymore. I'd appreciate if you can help me with that.

[FEATURE REQUEST] AES performance

  • FEATURE REQUEST

FEATURE REQUEST

aes driver performance

Justification

aes driver can only processing data at less than 20MB/s now
btw, dma cant work with aes module with batch size larger than 80 bytes, causes significant
overhead on generating dma requests.

Cannot compile on develop due to locks.c

Hi, when compiling from develop, I get a bunch of error related to functions and typedefs in lib/freertos/locks.c

/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:64:8: error: '_lock_t' does not name a type; did you mean 'clock_t'?
 static _lock_t dma_lock;
        ^~~~~~~
        clock_t
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp: In function 'handle_t dma_open_free()':
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:896:30: error: 'dma_lock' was not declared in this scope
     _lock_acquire_recursive(&dma_lock);
                              ^~~~~~~~
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:896:30: note: suggested alternative: 'dma_close'
     _lock_acquire_recursive(&dma_lock);
                              ^~~~~~~~
                              dma_close
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:896:5: error: '_lock_acquire_recursive' was not declared in this scope
     _lock_acquire_recursive(&dma_lock);
     ^~~~~~~~~~~~~~~~~~~~~~~
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:917:5: error: '_lock_release_recursive' was not declared in this scope
     _lock_release_recursive(&dma_lock);
     ^~~~~~~~~~~~~~~~~~~~~~~
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp: In function 'void dma_close(handle_t)':
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:924:30: error: 'dma_lock' was not declared in this scope
     _lock_acquire_recursive(&dma_lock);
                              ^~~~~~~~
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:924:30: note: suggested alternative: 'dma_close'
     _lock_acquire_recursive(&dma_lock);
                              ^~~~~~~~
                              dma_close
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:924:5: error: '_lock_acquire_recursive' was not declared in this scope
     _lock_acquire_recursive(&dma_lock);
     ^~~~~~~~~~~~~~~~~~~~~~~
/home/ndagestad/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:926:5: error: '_lock_release_recursive' was not declared in this scope
     _lock_release_recursive(&dma_lock);
     ^~~~~~~~~~~~~~~~~~~~~~~

I have a fork fixing it but I was wondering if I had done something wrong or if it is a known problem.

system: Arch Linux 64bit

No SDK for the APU

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

  • FEATURE REQUEST

FEATURE REQUEST

There is no SDK for the Kendryte K210 APU Audio Processing Unit

Justification

The datasheet for the Kendryte K210 lists the features that are selling points for the chip for AI, and the APU is very clearly listed as one of them, yet there is absolutely no way to access it on the user side, making it basically useless.

For people wanting to work more with audio, this is a pretty bad omission.

Workarounds

There is no way to access the APU via the SDK, so there is nothing I can do to fix it (since the Kendryte documentation is completely useless as it provides zero useful detail for a programmer to use, i.e. registers and timing/dataflow information).

Issues with updated 'develop' branch

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

hello_world doesn't compile

BUG REPORT

Expected behavior

hello_world example compiles

Actual behavior

> make
Scanning dependencies of target lwipcore
[  0%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/init.c.obj
[  1%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/def.c.obj
[  1%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/dns.c.obj
[  2%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/inet_chksum.c.obj
[  3%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ip.c.obj
[  3%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/mem.c.obj
[  4%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/memp.c.obj
[  5%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/netif.c.obj
[  5%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/pbuf.c.obj
[  6%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/raw.c.obj
[  6%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/stats.c.obj
[  7%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/sys.c.obj
[  8%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/altcp.c.obj
[  8%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/altcp_alloc.c.obj
[  9%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/altcp_tcp.c.obj
[ 10%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/tcp.c.obj
[ 10%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/tcp_in.c.obj
[ 11%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/tcp_out.c.obj
[ 11%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/timeouts.c.obj
[ 12%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/udp.c.obj
[ 13%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/arch/sys_arch.c.obj
[ 13%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/autoip.c.obj
[ 14%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/dhcp.c.obj
[ 14%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/etharp.c.obj
[ 15%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/icmp.c.obj
[ 16%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/igmp.c.obj
[ 16%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/ip4_frag.c.obj
[ 17%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/ip4.c.obj
[ 18%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv4/ip4_addr.c.obj
[ 18%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/dhcp6.c.obj
[ 19%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/ethip6.c.obj
[ 19%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/icmp6.c.obj
[ 20%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/inet6.c.obj
[ 21%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/ip6.c.obj
[ 21%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/ip6_addr.c.obj
[ 22%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/ip6_frag.c.obj
[ 22%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/mld6.c.obj
[ 23%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/core/ipv6/nd6.c.obj
[ 24%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/api_lib.c.obj
[ 24%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/api_msg.c.obj
[ 25%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/err.c.obj
[ 26%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/if_api.c.obj
[ 26%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/netbuf.c.obj
[ 27%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/netdb.c.obj
[ 27%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/netifapi.c.obj
[ 28%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/sockets.c.obj
[ 29%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/api/tcpip.c.obj
[ 29%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ethernet.c.obj
[ 30%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/bridgeif.c.obj
[ 30%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/bridgeif_fdb.c.obj
[ 31%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/slipif.c.obj
[ 32%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/lowpan6_common.c.obj
[ 32%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/lowpan6.c.obj
[ 33%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/lowpan6_ble.c.obj
[ 34%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/zepif.c.obj
[ 34%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/auth.c.obj
[ 35%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/ccp.c.obj
[ 35%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/chap-md5.c.obj
[ 36%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/chap_ms.c.obj
[ 37%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/chap-new.c.obj
[ 37%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/demand.c.obj
[ 38%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/eap.c.obj
[ 39%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/ecp.c.obj
[ 39%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/eui64.c.obj
[ 40%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/fsm.c.obj
[ 40%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/ipcp.c.obj
[ 41%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/ipv6cp.c.obj
[ 42%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/lcp.c.obj
[ 42%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/magic.c.obj
[ 43%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/mppe.c.obj
[ 43%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/multilink.c.obj
[ 44%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/ppp.c.obj
[ 45%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/pppapi.c.obj
[ 45%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/pppcrypt.c.obj
[ 46%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/pppoe.c.obj
[ 47%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/pppol2tp.c.obj
[ 47%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/pppos.c.obj
[ 48%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/upap.c.obj
[ 48%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/utils.c.obj
[ 49%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/vj.c.obj
[ 50%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/polarssl/arc4.c.obj
[ 50%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/polarssl/des.c.obj
[ 51%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/polarssl/md4.c.obj
[ 51%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/polarssl/md5.c.obj
[ 52%] Building C object third_party/lwip/CMakeFiles/lwipcore.dir/src/netif/ppp/polarssl/sha1.c.obj
[ 53%] Linking C static library liblwipcore.a
[ 53%] Built target lwipcore
Scanning dependencies of target hal
[ 53%] Building C object SDK/hal/CMakeFiles/hal.dir/clint.c.obj
[ 54%] Building C object SDK/hal/CMakeFiles/hal.dir/fpioa.c.obj
[ 55%] Building C object SDK/hal/CMakeFiles/hal.dir/sysctl.c.obj
[ 55%] Building C object SDK/hal/CMakeFiles/hal.dir/uarths.c.obj
[ 56%] Building C object SDK/hal/CMakeFiles/hal.dir/utility.c.obj
[ 56%] Linking C static library libhal.a
[ 56%] Built target hal
Scanning dependencies of target fatfs
[ 57%] Building C object third_party/fatfs/CMakeFiles/fatfs.dir/source/ff.c.obj
[ 58%] Building C object third_party/fatfs/CMakeFiles/fatfs.dir/source/ffsystem.c.obj
[ 58%] Building C object third_party/fatfs/CMakeFiles/fatfs.dir/source/ffunicode.c.obj
[ 59%] Linking C static library libfatfs.a
[ 59%] Built target fatfs
Scanning dependencies of target freertos
[ 60%] Building C object SDK/freertos/CMakeFiles/freertos.dir/core_sync.c.obj
[ 60%] Building C object SDK/freertos/CMakeFiles/freertos.dir/croutine.c.obj
[ 61%] Building C object SDK/freertos/CMakeFiles/freertos.dir/event_groups.c.obj
[ 61%] Building CXX object SDK/freertos/CMakeFiles/freertos.dir/kernel/devices.cpp.obj
[ 62%] Building CXX object SDK/freertos/CMakeFiles/freertos.dir/kernel/driver_impl.cpp.obj
[ 63%] Building CXX object SDK/freertos/CMakeFiles/freertos.dir/kernel/network/network.cpp.obj
[ 63%] Building CXX object SDK/freertos/CMakeFiles/freertos.dir/kernel/network/socket.cpp.obj
[ 64%] Building CXX object SDK/freertos/CMakeFiles/freertos.dir/kernel/storage/filesystem.cpp.obj
[ 65%] Building C object SDK/freertos/CMakeFiles/freertos.dir/list.c.obj
[ 65%] Building C object SDK/freertos/CMakeFiles/freertos.dir/locks.c.obj
[ 66%] Building C object SDK/freertos/CMakeFiles/freertos.dir/os_entry.c.obj
[ 66%] Building C object SDK/freertos/CMakeFiles/freertos.dir/portable/heap_4.c.obj
[ 67%] Building C object SDK/freertos/CMakeFiles/freertos.dir/portable/port.c.obj
[ 68%] Building C object SDK/freertos/CMakeFiles/freertos.dir/pthread.c.obj
[ 68%] Building C object SDK/freertos/CMakeFiles/freertos.dir/queue.c.obj
[ 69%] Building C object SDK/freertos/CMakeFiles/freertos.dir/stream_buffer.c.obj
[ 69%] Building C object SDK/freertos/CMakeFiles/freertos.dir/tasks.c.obj
[ 70%] Building C object SDK/freertos/CMakeFiles/freertos.dir/timers.c.obj
[ 71%] Linking C static library libfreertos.a
[ 71%] Built target freertos
Scanning dependencies of target bsp
[ 71%] Building C object SDK/bsp/CMakeFiles/bsp.dir/config/pin_cfg.c.obj
[ 72%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/aes.cpp.obj
[ 72%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/dmac.cpp.obj
[ 73%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/dvp.cpp.obj
[ 74%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/fft.cpp.obj
[ 74%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/gpio.cpp.obj
[ 75%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/gpiohs.cpp.obj
[ 75%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/i2c.cpp.obj
[ 76%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/i2s.cpp.obj
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/bsp/device/i2s.cpp: In member function 'virtual void k_i2s_driver::config_as_capture(const audio_format_t&, size_t, i2s_align_mode_t, uint32_t)':
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/bsp/device/i2s.cpp:269:30: warning: 'block_align' may be used uninitialized in this function [-Wmaybe-uninitialized]
         session_.block_align = block_align;
         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/bsp/device/i2s.cpp:251:36: warning: 'wlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 u_tcr.rcr_tcr.wlen = wlen;
                 ~~~~~~~~~~~~~~~~~~~^~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/bsp/device/i2s.cpp: In member function 'virtual void k_i2s_driver::config_as_render(const audio_format_t&, size_t, i2s_align_mode_t, uint32_t)':
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/bsp/device/i2s.cpp:97:18: warning: 'dma_divide16' may be used uninitialized in this function [-Wmaybe-uninitialized]
         uint32_t dma_divide16;
                  ^~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/bsp/device/i2s.cpp:162:30: warning: 'block_align' may be used uninitialized in this function [-Wmaybe-uninitialized]
         session_.block_align = block_align;
         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/bsp/device/i2s.cpp:144:36: warning: 'wlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
                 u_tcr.rcr_tcr.wlen = wlen;
                 ~~~~~~~~~~~~~~~~~~~^~~~~~
[ 77%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/kpu.cpp.obj
[ 77%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/plic.cpp.obj
[ 78%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/pwm.cpp.obj
[ 79%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/registry.cpp.obj
[ 79%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/rtc.cpp.obj
[ 80%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/sccb.cpp.obj
[ 80%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/sha256.cpp.obj
[ 81%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/spi.cpp.obj
[ 82%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/timer.cpp.obj
[ 82%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/uart.cpp.obj
[ 83%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/device/wdt.cpp.obj
[ 83%] Building C object SDK/bsp/CMakeFiles/bsp.dir/dump.c.obj
[ 84%] Building C object SDK/bsp/CMakeFiles/bsp.dir/entry_user.c.obj
[ 85%] Building C object SDK/bsp/CMakeFiles/bsp.dir/except.c.obj
[ 85%] Building C object SDK/bsp/CMakeFiles/bsp.dir/interrupt.c.obj
[ 86%] Building C object SDK/bsp/CMakeFiles/bsp.dir/printf.c.obj
[ 87%] Building C object SDK/bsp/CMakeFiles/bsp.dir/sleep.c.obj
[ 87%] Building C object SDK/bsp/CMakeFiles/bsp.dir/syscalls.c.obj
[ 88%] Building CXX object SDK/bsp/CMakeFiles/bsp.dir/syscalls/syscalls.cpp.obj
[ 88%] Building C object SDK/bsp/CMakeFiles/bsp.dir/crt.S.obj
[ 89%] Linking C static library libbsp.a
[ 89%] Built target bsp
Scanning dependencies of target drivers
[ 90%] Building CXX object SDK/drivers/CMakeFiles/drivers.dir/src/misc/ws2812b/ws2812b.cpp.obj
[ 90%] Building CXX object SDK/drivers/CMakeFiles/drivers.dir/src/network/dm9051.cpp.obj
[ 91%] Building CXX object SDK/drivers/CMakeFiles/drivers.dir/src/storage/sdcard.cpp.obj
[ 91%] Linking C static library libdrivers.a
[ 91%] Built target drivers
Scanning dependencies of target posix
[ 91%] Building CXX object SDK/posix/CMakeFiles/posix.dir/ioctl.cpp.obj
[ 92%] Building CXX object SDK/posix/CMakeFiles/posix.dir/ip4_addr.cpp.obj
[ 93%] Building CXX object SDK/posix/CMakeFiles/posix.dir/memory.cpp.obj
[ 93%] Building CXX object SDK/posix/CMakeFiles/posix.dir/netdb.cpp.obj
[ 94%] Building CXX object SDK/posix/CMakeFiles/posix.dir/posix_conf.cpp.obj
[ 94%] Building CXX object SDK/posix/CMakeFiles/posix.dir/pthread.cpp.obj
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:30:13: error: 'pthread_cond_init' was not declared in this scope
     (void *)pthread_cond_init,
             ^~~~~~~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:30:13: note: suggested alternative: 'pthread_cond_t'
     (void *)pthread_cond_init,
             ^~~~~~~~~~~~~~~~~
             pthread_cond_t
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:31:13: error: 'pthread_mutex_init' was not declared in this scope
     (void *)pthread_mutex_init,
             ^~~~~~~~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:31:13: note: suggested alternative: 'pthread_mutex_t'
     (void *)pthread_mutex_init,
             ^~~~~~~~~~~~~~~~~~
             pthread_mutex_t
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:32:13: error: 'pthread_self' was not declared in this scope
     (void *)pthread_self
             ^~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:32:13: note: suggested alternative: 'pthread_key_t'
     (void *)pthread_self
             ^~~~~~~~~~~~
             pthread_key_t
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:39:1: warning: missing initializer for member 'pthread_attr_t::is_initialized' [-Wmissing-field-initializers]
 };
 ^
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:39:1: warning: missing initializer for member 'pthread_attr_t::stackaddr' [-Wmissing-field-initializers]
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:39:1: warning: missing initializer for member 'pthread_attr_t::contentionscope' [-Wmissing-field-initializers]
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:39:1: warning: missing initializer for member 'pthread_attr_t::inheritsched' [-Wmissing-field-initializers]
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:39:1: warning: missing initializer for member 'pthread_attr_t::schedpolicy' [-Wmissing-field-initializers]
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp: In function 'int pthread_join(pthread_t, void**)':
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:186:27: error: 'pthread_self' was not declared in this scope
         if (pthread_equal(pthread_self(), pthread) != 0)
                           ^~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:186:27: note: suggested alternative: 'pthread_join'
         if (pthread_equal(pthread_self(), pthread) != 0)
                           ^~~~~~~~~~~~
                           pthread_join
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:186:13: error: 'pthread_equal' was not declared in this scope
         if (pthread_equal(pthread_self(), pthread) != 0)
             ^~~~~~~~~~~~~
/Users/nalzok/Developer/kendryte-freertos-sdk/lib/posix/pthread.cpp:186:13: note: suggested alternative: 'thread_local'
         if (pthread_equal(pthread_self(), pthread) != 0)
             ^~~~~~~~~~~~~
             thread_local
make[2]: *** [SDK/posix/CMakeFiles/posix.dir/pthread.cpp.obj] Error 1
make[1]: *** [SDK/posix/CMakeFiles/posix.dir/all] Error 2
make: *** [all] Error 2

Test code

#include <stdio.h>

int main()
{
    puts("Hello World\n");
    while (1)
        ;
}

Document version

f4d3bd9

Hardware

Maix M1W

System

macOS Mojave

ubuntu 18.04 crosstoolchain linkerr in libmpfr.so.4

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

  • BUG REPORT
  • FEATURE REQUEST

BUG REPORT

When use ubuntu 18.04 toolchain miss libmpfr.so.4 cause compile err in SDK

-- Configuring done
-- Generating done
-- Build files have been written to: /data/k210/kendryte-freertos-sdk-0.2.0/build
[ 1%] Building C object SDK/CMakeFiles/kendryte.dir/bsp/config/fpioa_cfg.c.obj
/opt/riscv-toolchain/bin/../libexec/gcc/riscv64-unknown-elf/7.2.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
SDK/CMakeFiles/kendryte.dir/build.make:62: recipe for target 'SDK/CMakeFiles/kendryte.dir/bsp/config/fpioa_cfg.c.obj' failed
make[2]: *** [SDK/CMakeFiles/kendryte.dir/bsp/config/fpioa_cfg.c.obj] Error 1
CMakeFiles/Makefile2:122: recipe for target 'SDK/CMakeFiles/kendryte.dir/all' failed
make[1]: *** [SDK/CMakeFiles/kendryte.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

when add env of LD_LIBRARY it fixed

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/riscv-toolchain/bin
server@server-AI:/opt/riscv-toolchain/bin$ cd /data/k210/kendryte-freertos-sdk-0.2.0/build/
server@server-AI:/data/k210/kendryte-freertos-sdk-0.2.0/build$ cmake .. -DPROJ=hello_world -DTOOLCHAIN=/opt/riscv-toolchain/bin && make

[ 92%] Building C object SDK/CMakeFiles/kendryte.dir/bsp/crt.S.obj
[ 94%] Building C object SDK/CMakeFiles/kendryte.dir/freertos/portable/portasm.S.obj
[ 96%] Linking C static library libkendryte.a
[ 96%] Built target kendryte
Scanning dependencies of target hello_world
[ 98%] Building C object CMakeFiles/hello_world.dir/src/hello_world/main.c.obj
[100%] Linking C executable hello_world
Generating .bin file ...
[100%] Built target hello_world

Move on to the Amazon maintained FreeRTOS base

It would be very helpful to me if this project were rebased as a fork on the Amazon maintained FreeRTOS tree. https://github.com/aws/amazon-freertos Scroll down and you can see that many vendors are using this code base -- Espressif, TI, ST, Cirrus, NXP, Mediatek, Cypress, Marvell, etc.. Rebasing on to the Amazon tree will make it easy to merge after everything is working.

Note that there is nothing Amazon specific about their FreeRTOS. Amazon is simply paying for people to maintain the code. There are a couple of AWS specific demos, but they are not a required part of the operating system.

Timer can not work

hello , I use the timer demo code in freeRTOS_programming_guide, but it can not work .
And I try other way to make it work such as opening other timer , setting shorter interval .but both of them are invalid.
This is my demo code.

void on_tick_test( void* unused )
{
        printk (" Time OK !\n");
}
int main(void)
{
	handle_t timer = io_open ("/dev/timer0");  
	timer_set_interval (timer , 1e9 );
	timer_set_on_tick (timer , on_tick , NULL );
	timer_set_enable (timer , true );
        while(1) ;
}

New issues with updated 'develop' branch

As I cannot reopen the closed issue, I'm posting it as a new one.
This continues discussion in #38

Running on both processors now works, but there is another issue:
Using floats (float or double type) produces a wrong result.

I've used a slightly changed task functions to test the floats:

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

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

It gives the following result (doubles are not printed):

TEST
Task at 0: 1, 101, nan
Task at 1: 1, 152, nan
Task at 0: 2, 201, nan
Task at 1: 2, 252, nan
Task at 0: 3, 301, nan
Task at 1: 3, 352, nan
Task at 0: 4, 401, nan
Task at 1: 4, 452, nan
Task at 0: 5, 501, nan
Task at 1: 5, 552, nan
Task at 0: 6, 601, nan
Task at 1: 6, 652, nan
Task at 0: 7, 701, nan
Task at 1: 7, 752, nan
Task at 0: 8, 801, nan
Task at 1: 8, 852, nan
Task at 0: 9, 901, nan
Task at 1: 9, 952, nan
Task at 0: 10, 1001, nan
Task at 1: 10, 1052, nan

Changing crt.S to the one from (now deleted) new_sched branch results in correct result:

TEST
Task at 0: 1, 101, 81.810
Task at 1: 1, 152, 123.120
Task at 0: 2, 201, 162.810
Task at 1: 2, 252, 204.120
Task at 0: 3, 301, 243.810
Task at 1: 3, 352, 285.120
Task at 0: 4, 401, 324.810
Task at 1: 4, 452, 366.120
Task at 0: 5, 501, 405.810
Task at 1: 5, 552, 447.120
Task at 0: 6, 601, 486.810
Task at 1: 6, 652, 528.120
Task at 0: 7, 701, 567.810
Task at 1: 7, 752, 609.120
Task at 0: 8, 801, 648.810
Task at 1: 8, 852, 690.120
Task at 0: 9, 901, 729.810
Task at 1: 9, 952, 771.120
Task at 0: 10, 1001, 810.810
Task at 1: 10, 1052, 852.120

Why was it changed ?

nncase

  • [X ] FEATURE REQUEST

FEATURE REQUEST

nncase model supports

Justification

when can the nncase model be supported in the freeRTOS_SDK? I don't want to use the standalone sdk.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.