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

Fix SPI Send Upstream #46

Merged
merged 60 commits into from
Mar 28, 2022
Merged

Fix SPI Send Upstream #46

merged 60 commits into from
Mar 28, 2022

Conversation

lupyuen
Copy link
Owner

@lupyuen lupyuen commented Mar 28, 2022

No description provided.

xiaoxiang781216 and others added 30 commits March 22, 2022 08:37
…truncated copying 16 bytes from a string of length 31

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
… destination size

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Harri Luhtala <harri.luhtala@haltian.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
to avoid the same label print multiple time in one dumpstack

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
…re bytes into a region of size 0 overflows the destination

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
follow up the bellow chnage:
commit 0f2f48f
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Sun Mar 20 18:12:26 2022 +0800

    sys/type.h: Change pid_t from int16_t to int

    to fix the following warning:
    include/unistd.h:302:9: error: incompatible redeclaration of library function 'vfork' [-Werror,-Wincompatible-library-redeclaration]
    pid_t   vfork(void);
            ^
    include/unistd.h:302:9: note: 'vfork' is a builtin with type 'int (void)'

    and change 32768 to INT_MAX to match the type change

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
The jump instruction relocation had an assert that tests for jumps with
an offset of 0. This makes it so that a while(1); statement causes an
assert because the jump instruction points to the same address, which
is perfectly legal.

Addend was not handled correctly in several reloc types.

Add ADD32/64 + SUB32/64 relocations, for some reason the compiler
I use likes to add them.
since xcpt always point to the stack after the below change:
commit 7b99788
Author: chao.an <anchao@xiaomi.com>
Date:   Tue Mar 1 01:06:24 2022 +0800

    arch/arm: optimize context switch speed

    The current context save implementation saves registers of each task
    to xcp context, which is unnecessary because most of the arm registers are
    already saved in the task stack, this commit replace the xcp context with
    stack context to improve context switching performance and reduce the tcb
    space occupation of tcb instance.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Preparation for CONFIG_BUILD_KERNEL=y, which requires that a kernel
stack is allocated for each user process.
Just add the kernel stack dumping for completeness
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
appropriately.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
this is a tool,when crash help you to debug.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Summary:
- This commit fixes stack corruption for rv64 configs

Impact:
- None

Testing:
- Tested with qemu-6.2

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
specify here:
https://man7.org/linux/man-pages/man3/getentropy.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
gustavonihei and others added 29 commits March 25, 2022 15:56
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Fix this compile-time warning:

rptun/rptun.c:956:22: warning: '%lx' directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Wformat-truncation=]
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
      |                      ^~~~~
rptun/rptun.c:956:25: note: format string is defined here
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
rptun/rptun.c:956:22: note: directive argument in the range [1, 18446744073709551615]
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
      |                      ^~~~~
rptun/rptun.c:956:3: note: 'snprintf' output between 4 and 19 bytes into a destination of size 16
  956 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
Fix this compile-time warning:

rpmsg/rpmsg_sockif.c:381:24: warning: format '%d' expects argument of type 'int', but argument 3 has type 'ssize_t' {aka 'long int'} [-Wformat=]
  381 |                   nerr("circbuf_write overflow, %d, %d\n", written, len);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~
      |                                                            |
      |                                                            ssize_t {aka long int}

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
default turn off.
turn on: echo on > /proc/memdump
turn off: echo off > proc/memdump

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
-#9  0xf7abf899 in __asan::__asan_report_load2 (addr=4072681776) at ../../../../../src/libsanitizer/asan/asan_rtl.cc:117
-#10 0x5693f718 in inode_release (node=0xf2c03124) at inode/fs_inoderelease.c:69
-#11 0x568ea61b in file_close (filep=0xf55fedd0) at vfs/fs_close.c:79
-#12 0x568e7e56 in nx_close (fd=3) at inode/fs_files.c:528
-#13 0x568e7f0e in close (fd=3) at inode/fs_files.c:562
-#14 0x56e76c39 in epoll_close (epfd=3) at vfs/fs_epoll.c:252
-#15 0x56c33829 in sensor_service_delete (ctrl=0x578b8540 <control>) at src/common.c:439
-#16 0x56a0561e in sensor_middle_service_main (argc=1, argv=0xf55de820) at sensor_main.c:118
-#17 0x56878675 in nxtask_startup (entrypt=0x56a054cc <sensor_middle_service_main>, argc=1, argv=0xf55de820) at sched/task_startup.c:70
-#18 0x5684427a in nxtask_start () at task/task_start.c:133
-#19 0xdeadbeef in ?? ()

reason:
epoll_close -> close -> epoll_do_close (free inode)
                     -> inode_release  (reuse inode, crash)

fix:
use the global inode to match the fd which will return to user.
like the g_sock_inode in fs/socket/socket.c

Signed-off-by: ligd <liguiding1@xiaomi.com>
Mounting ROMFS filesystem at target=/usr/local/share with source=/dev/ram1
Traversing directory: /usr/local/share
  DIRECTORY: /usr/local/share/adir/
Traversing directory: /usr/local/share/adir
  FILE: /usr/local/share/adir/anotherfile.txt/
  DIRECTORY: /usr/local/share/adir/subdir/
Traversing directory: /usr/local/share/adir/subdir
  FILE: /usr/local/share/adir/subdir/subdirfile.txt/
Continuing directory: /usr/local/share/adir
  FILE: /usr/local/share/adir/yafile.txt/
Continuing directory: /usr/local/share
  FILE: /usr/local/share/afile.txt/
  FILE: /usr/local/share/hfile/
ERROR: ldir never found
Finished with  1 errors

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
…arch.h)

and include the used header files(nuttx/clock.h and nuttx/semaphore.h)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
VELAPLATFO-1491

Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
## Summary

SPI Poll Send `bl602_spi_poll_send()` doesn't send any SPI Data because it doesn't enable SPI Master and it doesn't clear the SPI FIFO. Also it hangs because it loops forever waiting for the FIFO.

We fix this problem by moving the code that enables SPI Master and clears the FIFO, from SPI Poll Exchange `bl602_spi_poll_exchange()` to SPI Poll Send. (Note that SPI Poll Exchange calls SPI Poll Send)

[More Details Here](https://github.com/lupyuen/st7789-nuttx#fix-spi-send)

## Impact

This problem affects all NuttX Drivers that call `SPI_SEND()` on BL602, including the ST7789 Display Driver.

Previously `SPI_SEND()` didn't send any SPI Data and never returns, because it loops forever waiting to receive data.

Now `SPI_SEND()` sends data and returns correctly.

[More Details Here](https://github.com/lupyuen/st7789-nuttx#fix-spi-send)

## Testing

We tested the modified SPI Poll Send with NuttX ST7789 Driver and a Logic Analyser on PineCone BL602:

-  [Testing with Logic Analyser](https://github.com/lupyuen/st7789-nuttx#fix-spi-send)

We also tested LVGL with ST7789 on PineCone BL602:

-  [Testing with LVGL](https://github.com/lupyuen/st7789-nuttx#run-lvgl-demo)

As for the modified SPI Poll Exchange, we tested with Semtech SX1262 SPI Transceiver on PineCone BL602:

-  [Testing SPI Poll Exchange](https://github.com/lupyuen/incubator-nuttx/releases/tag/release-2022-03-25)
@lupyuen lupyuen merged commit 1c82dba into master Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.