Giter Club home page Giter Club logo

wm-sdk-w806's Introduction

English Readme | 中文说明

About

A SDK for WinnerMicro MCU W806.

File Structure

wm-sdk-w806
├─app              # User application code
├─bin              # Compilation results
├─demo             # Demos
├─include          # SDK header files 
├─ld               # Link scripts
├─lib              # Libraries
├─Makefile
├─platform         # SDK source code
└─tools            # Utilities

For Linux Users

Download Toolchains

Installation

Extract the toolchains to proper folder -- be careful that the tar ball use ./ as top level path, move it to a seperate folder or specify a target folder for the uncompressing.

mkdir csky-elfabiv2-tools-x86_64-minilibc-20210423
tar xvf csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz  -C csky-elfabiv2-tools-x86_64-minilibc-20210423/

Then move it to somewhere, e.g. /opt/toolchains, set it read-only to normal users

cd /opt/toolchains/
sudo mv ~/Download/csky-elfabiv2-tools-x86_64-minilibc-20210423/ .
sudo chown -R root:root csky-elfabiv2-tools-x86_64-minilibc-20210423/

You don't need to add it to the system PATH variable.

Building

Checkout this project

git clone https://github.com/IOsetting/wm-sdk-w806.git

Run menuconfig, configurate the toolchains path

cd wm-sdk-w806
make menuconfig

In menuconfig, navigate to Toolchain Configuration, In the second line "the toolchain path", input the absolute path of the toolchains executables, e.g.

/opt/toolchains/csky-elfabiv2-tools-x86_64-minilibc-20210423/bin/

Leave other settings unchanged, save and exit menuconfig.

Then build the project

make

More Building Options

  • UART0 printf() output
    In /include/arch/xt804/csi_config.h, option USE_UART0_PRINT controls whether use UART0 to send printf() output, it is turned on by default. Note: This feature will occupy UART0, if any other devices are going to communicate with UART0, please turn it off.
  • Hands-free download
    In /include/arch/xt804/csi_config.h, option USE_UART0_AUTO_DL controls enable/disable automatic download, it is turned off by default. When it is enabled, download tool will reset the board automatically before the downloading. Option USE_UART0_PRINT should be enabled to make this work.

Download To Development Board

Connect the development board to PC, get the USB port name by commands dmesg, lsusb and ls /dev/tty*.

Run menuconfig to set the download port

cd wm-sdk-w806
make menuconfig

In menuconfig, navigate to Download Configuration

  • Download port: Input the USB port name, e.g. ttyUSB0;
  • Down rate: Input the UART baud rate, the higher rate the higher download speed. The availabe options are 115200, 460800, 921600, 1000000 and 2000000.

Then save and exit menuconfig, download the hex file to development board

make flash

Press the Reset key to start the downloading. If previously downloaded hex was built with USE_UART0_AUTO_DL enabled, the board will start downloading automatically.

build finished!
connecting serial...
serial connected.
wait serial sync.........         <--- Press the Reset key here
please manually reset the device. <--- (Or here)
.....
serial sync sucess.
mac CC-CC-CC-CC-CC-CC.
start download.
0% [###] 100%
download completed.
reset command has been sent.

When downloding finishes, the board will be reset automatically to run the new program. In case the auto-reset fails, you need to press the reset key manually to make it run.

More Download Options

Show serial ports

make list

Build, download and start serial monitor

make run

Start serial monitor only

make monitor

For Windows Users

Download Toolchains

Installation

  • Run msys2-x86_64-yyyymmdd.exe to install MSYS2
  • When the installation finishes, install necessary tools in MSYS2 console
# Update all packages
pacman -Syu
# Install make
pacman -S msys/make
# Install automake
pacman -S msys/automake
# Install autoconf
pacman -S msys/autoconf
# Install gcc
pacman -S msys/gcc
# Install git
pacman -S msys/git
# Install dependencies
pacman -S msys/ncurses-devel
pacman -S msys/gettext-devel

Extract toolchains to specified folder

mkdir csky-elfabiv2-tools-mingw-minilibc-20210423
tar xvf csky-elfabiv2-tools-mingw-minilibc-20210423.tar.gz -C csky-elfabiv2-tools-mingw-minilibc-20210423/

Note down the full path of toolchain executables, e.g. /d/w806/csky-elfabiv2-tools-mingw-minilibc-20210423/bin/.

Building

Check out this SDK

git clone https://github.com/IOsetting/wm-sdk-w806.git

Configurate toolchains path in menuconfig

cd wm-sdk-w806
make menuconfig

In menuconfig, navigate to Toolchain Configuration -> toolchain path, input the path (including the tail slash '/'), e.g.

/d/w806/csky-elfabiv2-tools-mingw-minilibc-20210423/bin/

Leave other settings unchanged, save and exit menuconfig.

Then build the project

make

The result files are under bin/W806.

Download To Development Board

Option 1: Upgrade_Tools

  • Connect the development board to your PC
  • Run flash tool Upgrade_Tools_V1.4.8.exe
  • Select the correct COM port, and use the default baud rate 115200, Click 打开串口
  • Select bin file 'W806.fls' from bin/W806
  • Click 下载 to start download
  • Press Reset key to reset board, then it will start downloading.
  • When downloading finishes, press Reset key again to make it run.

Option 2: wm_tool

Find the port name of connected board in Device Manager, e.g. COM5.

Run menuconfig to set the download port

cd wm-sdk-w806
make menuconfig

In menuconfig, navigate to Download Configuration

  • Download port: Input the USB port name, e.g. COM5;
  • Down rate: The higher rate the higher download speed, the availabe options are 115200, 460800, 921600, 1000000 and 2000000.

The rest are the same as operations in Linux, please refer to Linux - Download To Development Board.

Problems

  1. Download Failed
    When it shows can not open serial make: *** [tools/w806/rules.mk:158: flash] Error 255, check if any other applications are occupying the USB port, if yes, close it and retry.
  2. Delay function failed in FreeRTOS
    In /include/arch/xt804/csi_config.h, please comment out #define CONFIG_KERNEL_NONE 1
  3. Hex is not updated
    If the compilation doesn't reflect your code changes, please clean the workspace withmake clean or make distclean
  4. Auto-reset failed
    In some cases the auto-reset may fail, you need to press the Reset key to reset the board manually.

License

The code of WM-SDK-W806 is licensed under the Apache-2.0 license.

As WM-SDK-W806 includes code from many upstream projects it includes many copyright owners. WM-SDK-W806 makes NO claim of copyright on any upstream code. Patches to upstream code have the same license as the upstream project, unless specified otherwise. For a complete copyright list please checkout the source code to examine license headers.

Unless expressly stated otherwise all code submitted to the WM-SDK-W806 project (in any form) will be licensed under Apache-2.0 license. You are absolutely free to retain copyright. To retain copyright simply add a copyright header to each submitted code page. If you submit code that is not your own work it is your responsibility to resolve the conflicts and place a header stating the copyright.

wm-sdk-w806's People

Contributors

afilez avatar fl0wl0w avatar iosetting avatar jg1uaa avatar xuhg-zjcn 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

wm-sdk-w806's Issues

ld: error: no memory region specified for loadable section `.eh_frame_hdr'

ok ... ld: error: no memory region specified for loadable section `.eh_frame_hdr'

text of config ...
`#
Automatically generated file; DO NOT EDIT.
WinnerMicro W800 Configuration

Firmware Configuration

CONFIG_W800_TARGET_NAME="W806"
CONFIG_W800_IMAGE_TYPE=1
CONFIG_W800_IMAGE_HEADER=8010000
CONFIG_W800_RUN_ADDRESS=8010400
CONFIG_W800_UPDATE_ADDRESS=8010000
CONFIG_W800_PRIKEY_SEL=0
CONFIG_W800_IMAGE_SIGNATURE=0
CONFIG_W800_CODE_ENCRYPT=0
CONFIG_W800_SIGN_PUBKEY_SRC=0

Download Configuration

CONFIG_W800_DOWNLOAD_PORT="ttyUSB0"
CONFIG_W800_DOWNLOAD_RATE=2000000

Compile Configuration

CONFIG_W800_USE_LIB is not set
CONFIG_W800_FIRMWARE_DEBUG is not set

Toolchain Configuration

CONFIG_W800_TOOLCHAIN_PREFIX="csky-abiv2-linux"
CONFIG_W800_TOOLCHAIN_PATH="/opt/toolchains/csky-linux-gnuabiv2-tools-x86_64-glibc-linux-4.9.56-20210423/bin/"`

How to make own custom app / Project template

Hi there, I managed to compile and flash the W806 kit successfully using the guides provided.

However, I'm not sure which app it uploads to the board. It said "W806.bin" in the "make flash" output - but I couldn't locate that sample app that is associated with the W806.bin. Is it in the "demo" folder, or one of the apps in the "app" folder?

Also, it could be easy if there's an empty project template which I can work on different things. Is it possible to just reuse that whole "WM-SDK-W806" folder and add my custom app inside (possibly passing a parameter to the make command?), or I have to create another separate copy of "WM-SDK-W806" if I need to have my own app inside?

libc_port.c caused compiler error

PS: I have read through your closed issue for libc_port.c. And I can not see the final conclusion and solution for that. So I re-open the issue.

I following the instruction on your CSDN page, with only exepctions, that I downloaded the toolchain from the WM website.

I repeated my procedure three times on:

  • Alicloud ECS with Ubuntu 16.04 x86_64 (amd64)
  • Ubuntu Kylin 20.04 x86_64 (amd64)
  • WSL1 Ubuntu 18.04 x86_64

I tried to build wm-sdk-w806/wm-sdk-w80x. The strange things are:

  • AliCloud Ubuntu, w806 [Y]/w80x [Y]
  • Kylin Ubuntu, w806 [N]/w80x [Y]
  • WSL1 Ubuntu, w806 [N]/w80x [Y]

I installed csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz toolchain and cloned the source from Github into a Ubuntu in ECS. I can make all successfully and it also works fine for wm-sdk-w80x.

However when I repeat the procedure on Kylin Ubuntu 20.04 64bit version in my desktop, I got a compilation error as following:

$ make all
......
AR       libwmbsp.a
/opt/toolchains/csky-elfabiv2-tools-x86_64-minilibc-20210423/bin/csky-abiv2-elf-ar: creating ../../../../bin/build/W806/lib/libwmbsp.a
make[3]: Leaving directory '/home/allankliu/wm-sdk-w806/platform/arch/xt804/bsp'
make[3]: Entering directory '/home/allankliu/wm-sdk-w806/platform/arch/xt804/libc'
CC       libc_port.c
libc_port.c: In function ‘_ftoa’:
libc_port.c:888:3: internal compiler error: Illegal instruction
   if (diff > 0.5) {
   ^~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
../../../../tools/W806/rules.mk:183: recipe for target '../../../../bin/build/W806/obj/platform/arch/xt804/libc/libc_port.o' failed
make[3]: *** [../../../../bin/build/W806/obj/platform/arch/xt804/libc/libc_port.o] Error 1
make[3]: Leaving directory '/home/allankliu/wm-sdk-w806/platform/arch/xt804/libc'
../../../tools/W806/rules.mk:170: recipe for target '.subdirs' failed
make[2]: *** [.subdirs] Error 2
make[2]: Leaving directory '/home/allankliu/wm-sdk-w806/platform/arch/xt804'
../../tools/W806/rules.mk:170: recipe for target '.subdirs' failed
make[1]: *** [.subdirs] Error 2
make[1]: Leaving directory '/home/allankliu/wm-sdk-w806/platform/arch'
tools/W806/rules.mk:170: recipe for target '.subdirs' failed
make: *** [.subdirs] Error 2

But building for wm-sdk-w80x works fine. I compared the sources between ECS/Desktop, the csky tools are identical, the sources are identical. But only building for wm-sdk-w806 will throw such error in my desktop. And it will throw the error in some other local machines. I git pull the source, I changed the source...... I didn't get any clue. So far I have to build the source in the ECS anyway.

The good news is that I have both working and non-working samples at hand. The bad news is that I can not find the clue.

w806 CPU exception

Hello, Friends. I tried to connect the fatfs library to the SDHC card via SPI on the w806. My card initialization is going well. And when I try to read one block, I get an error on UART monitor:
CPU Exception : 7r0: 00000000 r1: 001010a9 r2: 00000001 r3: 001000a9 r4: c08ed88e r5: 7c00befb r6: b90600bf r7: a4f30200 r8: 4de428b3 r9: 4c83600a r10: 4e46aa12 r11: 3384e604 r12: ffffffff r13: 0000002d r14: 20001100 r15: 000621ea epsr: e0000340epc : 4dfa.
My question is: what could be the problem? In which files is CPU exceptions processing located? In which file is the stack fnd heap size specified?
I also tried to write a library to work with HARD I2C. Did you also fail to get the START command on the bus? Is it a hardware problem in the chip?
I will be very grateful for answers to my questions. I would really like to understand the work of this MCU in more detail.
My email [email protected] .

Timer Demo not working

Compiled Timer Demo (/demo/tim) and flashed it to w806.

In serial monitor it doesn't serial print anything, it displays only "enter main" and then nothing...

"Enable Use Lib" does not work correctly in SDK and CDK project.

Hello there,
I have just compiled a simple C++14 app with a number of constexpr and static declarations. However, it could not compile with reasons of undefined reference to __cxa_guard_acquire in the compilation.

From the static compilation guides in C++, it is noticed that some form of stdlib needed to be enabled to be successfully compiled, or disabling the thread safety mechanism. However, since this app will be also used with a FreeRTOS, I will have to use the libc ("Enable Use Lib"?) provided.

After enabling the "Enable Use Lib" in menuconfig, and compiling it, I got a warning:

0/../../../../csky-elfabiv2/bin/ld.exe: warning: cannot find entry symbol Reset_Handler; defaulting to 08010400
OBJCOPY  W806.bin
generate normal image completed.
generate normal image completed.
compress binary completed.
generate compressed image completed.
build finished!
connecting serial...

and I could not get the program to run, and I'm suspecting it's just waiting for the user to upload binary in the terminal:
MMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
It is possible too that it's not jumping to the intended program location.

not programing ??????????????

first of all thank you for the answer and the project ...

well .... I bought the product from aliexpress and programmed the gpio example to see if it loaded ... now I have made a program for a greenhouse control and what is my surprise that when I save it (without compilation errors) I get it says that it is recorded (without errors) but instead there is still the led program, since my program does not use leds

Commenting out CONFIG_KERNEL_NONE = 1 might be switching off the interrupts.

I'm working on a small W806 app (https://github.com/nyh-workshop/w806-i2s) and trying to put a FreeRTOS inside.

From the readme, I need to comment out the "CONFIG_KERNEL_NONE = 1" or else it won't work.

However when I comment out this setting, most of the interrupts are not being called anymore, even the DMA ones.

There is someone also discussing about this here: http://ask.winnermicro.com/question/269.html. There is a possible answer at the bottom of that thread - however my Mandarin is limited and the translation seems to be not working good today.

It could mean to remove the macros, but I'm not sure which one to remove on these files.

Windows msys2 $make menuconfig gives Permission denied

Error:
running msys2 build system gives the following error, while attempting to change toolchain executables path
$ make menuconfig
make: ./tools/W806/mconfig.sh: Permission denied
make: *** [tools/W806/rules.mk:141: menuconfig] Error 127

system:
msys2 is running onto windows 11, all necessary packages updated/installed
msys2 (run as admin) did not work

SPI (including Demo) Projects do not compile - because of 'SPI' undeclared Error

** SPI (including Demo) Projects do not compile - because of 'SPI' undeclared Error : **

/wm-sdk-w806/demo/fatfs
/wm-sdk-w806/demo/spi/spi_basic

--

$ make flash
make[1]: Entering directory '/home/Dell/wm-sdk-w806/app'
make[2]: Entering directory '/home/Dell/wm-sdk-w806/app/src'
CC main.c
main.c: In function 'SPI_Init':
main.c:290:21: error: 'SPI' undeclared (first use in this function)
hspi.Instance = SPI;
^~~
main.c:290:21: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [../../tools/W806/rules.mk:184: ../../bin/build/W806/obj/app/src/main.o] Error 1
make[2]: Leaving directory '/home/Dell/wm-sdk-w806/app/src'
make[1]: *** [../tools/W806/rules.mk:170: .subdirs] Error 2
make[1]: Leaving directory '/home/Dell/wm-sdk-w806/app'
make: *** [tools/W806/rules.mk:170: .subdirs] Error 2

error libc

CC libc_port.c
libc_port.c: In function ‘_ftoa’:
libc_port.c:888:3: internal compiler error: Instrucción ilegal
if (diff > 0.5) {
^~
csky-elfabiv2-tools-x86_64-minilibc-20210423

tanks ( git clone repository)

Serial Sync Timeout even when pressing RST

Hello, thank you for the repo, I have a problem, it keeps showing
"please manually reset the device.
.......................................................
serial sync timeout."

even after I click on Reset, the programming doesn't start. any idea ? I'm using wm801 board V1.1.

N;B: when I use the code with arduino IDE, I can program it without pressing on RST, and works smoothly. here is the link to Arduino IDE variant : https://github.com/Hi-LinkDuino/w80x_arduino
So I mean there is no physical problem with the board.

Thank you.

enable signature and privkey load

I am trying to enable firmware signature but it just doesn't work.

I first enabled image key select with/without signature. the code just works irrespective of anything.

I dont see any way to flash the otp or something to load the priv key inside.

I2S and DMA: Trouble getting Circular to work, and what are differences between Normal Circular vs. Link Circular?

Hi there,
I am trying to write a simple I2S and DMA example of a circular buffer with only the DMA TX.
However, I could not get these "Half Complete" and "Complete" interrupts to be triggered. There is no response after calling HAL_I2S_Transmit_DMA. All it does now is to jump to the while loop in the main.

In the library, there are two DMA transfer modes: Link and Normal. I am not entirely sure what are the differences between that, so I picked the Normal.

Here are the parts of the code, which I modified from the i2s example:

main.c

int main(void)
{
    SystemClock_Config(CPU_CLK_160M);
    printf("enter main\r\n");
    
    HAL_Init();
    DMA_Init();
    I2S_Init();
    
    // I2S_BUFFER_SIZE is 512 in my modified example:
    memset(tx_buf, 0x00, I2S_BUFFER_SIZE);

    HAL_I2S_Transmit_DMA(&hi2s, (uint32_t*)tx_buf, I2S_BUFFER_SIZE);

    while (1)
    {
        printf(".");
        HAL_Delay(1000);
    }
}

static void DMA_Init(void)
{
    __HAL_RCC_DMA_CLK_ENABLE();
    
    HAL_NVIC_SetPriority(DMA_Channel0_IRQn, 0);
    HAL_NVIC_EnableIRQ(DMA_Channel0_IRQn);
    
}

void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
{
    printf("tx halfcplt\r\n");
}

void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{
    printf("tx cplt\r\n");
}

wm_hal_msp.c:

void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s)
{
    if (hi2s->Instance == I2S)
    {
        __HAL_RCC_I2S_CLK_ENABLE();
        __HAL_RCC_GPIO_CLK_ENABLE();
        
        __HAL_AFIO_REMAP_I2S_MCK(GPIOA, GPIO_PIN_7);
        __HAL_AFIO_REMAP_I2S_WS(GPIOB, GPIO_PIN_9);
        __HAL_AFIO_REMAP_I2S_CK(GPIOB, GPIO_PIN_8);
        __HAL_AFIO_REMAP_I2S_MOSI(GPIOB, GPIO_PIN_11);
        __HAL_AFIO_REMAP_I2S_MISO(GPIOB, GPIO_PIN_10);
        
        hdma_i2s_tx.Instance = DMA_Channel0;
        hdma_i2s_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
        hdma_i2s_tx.Init.DestInc = DMA_DINC_DISABLE;
        hdma_i2s_tx.Init.SrcInc = DMA_SINC_CIRCULAR;
        hdma_i2s_tx.Init.DataAlignment = DMA_DATAALIGN_WORD;
        hdma_i2s_tx.Init.Mode = DMA_MODE_NORMAL_CIRCULAR;
        hdma_i2s_tx.Init.RequestSourceSel = DMA_REQUEST_SOURCE_I2S_TX;
        
        hdma_i2s_tx.LinkDesc = tx_desc;
        
        if (HAL_DMA_Init(&hdma_i2s_tx) != HAL_OK)
        {
            Error_Handler();
        }
        __HAL_LINKDMA(hi2s, hdmatx, hdma_i2s_tx);   

        HAL_NVIC_SetPriority(I2S_IRQn, 1);
        HAL_NVIC_EnableIRQ(I2S_IRQn);
    }
}

Is the Circular mode, when running, should trigger both the Half-Transfer Complete and Transfer Complete interrupts continuously?

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.