Commit Graph

49476 Commits

Author SHA1 Message Date
Eero Nurkkala
816b971e70 risc-v/mpfs: i2c: add more FPGA i2cs
This adds 2 more FPGA I2Cs. Also rework the indexing
so that it matches the earlier work without major changes.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2023-05-29 20:45:01 +08:00
Eero Nurkkala
53b58b0881 risc-v/mpfs: i2c: fix an FPGA known issue
This fixes the following issue:
  - After sending the address, the driver writes an extra zero

Without this patch, the extra write causes an extra ACK that would
terminate the sequence prematurely. This is observed as data read
corruption.

With this fix, the condition is detected precisely. That being the
case, the sequence is continued with a repeated start, after which
the read continues normally.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2023-05-29 20:45:01 +08:00
Eero Nurkkala
a0bde84c9a risc-v/mpfs: integrate fpga i2c driver
This incorporates an fpga i2c driver into the existing i2c driver.
This fpga i2c works almost 100% as the MSS i2c, but the difference
is that the fpga driver terminates all transactions with a stop
sent -interrupt. That needs to be handled.

Fpga clock source is also different, act accordingly.

SEC2TICK(10) is an overkill to any app, use just one second instead.

modifyreg32s are simplified as well, no need to clear and set
as set is enough.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2023-05-29 20:45:01 +08:00
Jani Paalijarvi
0fefc43458 mpfs: i2c: Fix reset and interrupt issues
I2C status register reset value (0xf8) was not handled properly causing unnecessary bus resets.
Added critical section to mpfs_i2c_reset() and removed unnecessary interrupt disabling elsewhere.
2023-05-29 20:45:01 +08:00
Zhe Weng
7d1b733202 net/tcp: Add flag for tcp_close to avoid double free
Problem:
When tcp_close_work starts to run in LPWORK, if another event comes and
calls tcp_free before tcp_close_work takes net_lock, the tcp_free will
be called twice and cause double free.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-05-29 13:00:06 +02:00
Michal Lenc
f4d409b3e5 boards/samv7/common: add type member to mtd_partition_s structure
Board related code may use different mounts for MTD device (block
character for one, SmartFS for another) if required by the board.
Additional type member was therefore added to mtd_partition_s structure
in order to support this.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-29 13:50:34 +03:00
Xiang Xiao
dde8ae468e fs/partition: register partition device if caller doesn't provide handler
to avoid the duplication of common logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-27 20:23:17 -03:00
Xiang Xiao
5528c84c03 fs/partition: MBR parser should initialize blocksize field
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-27 20:23:17 -03:00
Roberto Bucher
547e0a051f DIR/Complementary PWM possible on PE08 and PE10 2023-05-27 20:22:01 -03:00
Roy Feng
bcd776b2a7 Fix build issues for ESP32 SoftAP mode 2023-05-27 23:54:55 +09:00
raiden00pl
20af03b31e arch/{nrf52|nrf53}/usbd: fix IN endpoint completion logic
Confirmation of the IN request must be done immediately after all data has been transferred,
otherwise sending data when more than one request has been added to the queue will
not work properly.
2023-05-27 18:52:16 +08:00
Michal Lenc
5f5ffa9380 fix compile warnings caused by incorrect variable format in print
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-27 18:52:01 +08:00
wangbowen6
4a8331a019 openamp: virtio.h add version field in device id table struct
Add new patch 0019, this patch is used to support the legacy virtio
mmio trasport.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-05-27 18:51:04 +08:00
hujun5
d70d406161 libc/fdsan: add fdsan protection for all file pointers
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-27 15:05:44 +08:00
Dong Heng
97d2d6376d xtensa/esp32s3: SPI slave driver 2023-05-27 14:11:36 +08:00
TimJTi
27fb0c76c9 SAMA5D2, improve LCD support 2023-05-27 14:03:51 +08:00
Michael Jung
2e27698d6c SLIP: Switch to poll based design
This is a refactored version of the SLIP network driver.  Updates
include:

1. The original design started two kernel threads per SLIP device.
   The refactored version uses file_poll to essentially be driven
   by the UART RX and TX interrupts and pushes work to the low
   priority work queue.

2. The SLIP byte un-/stuffing is more efficient now, using memcpy
   instead of handling each byte individually.

3. The switch of the old SLIP driver to IOBs caused buffer overwrites
   if packets were sent that would not fit into a single IOB.  This is
   fixed now.

Signed-off-by: Michael Jung <michael.jung@secore.ly>
2023-05-26 19:57:57 -03:00
liaoao
6424b5322f procfs:add xtensa cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
liaoao
db53c7abcf procfs:add armv8-m cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
liaoao
8a5bf87c72 procfs:add risc-v cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
liaoao
1abe90c7cd procfs:add armv7-r cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
liaoao
5c5d9420af procfs:add armv7-a cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
liaoao
108c47c07b procfs:add armv7-m cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
liaoao
6ea3eb3ce2 procfs:add /proc/cpuinfo
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-05-27 03:29:41 +08:00
Ville Juven
ac4183e589 socket/send/recv: Copy user parameters to kernel memory (BUILD_KERNEL)
Need to copy the user pointers into kernel memory before calling send/recv,
because devif_poll() and others will fail at once due to wrong mappings.
2023-05-27 03:24:06 +08:00
Ville Juven
4ed4e3ca36 net/socket: Combine send() with sendto()
send() is just a specific flavor of sendto(), thus they can be combined.
2023-05-27 03:24:06 +08:00
paolovolpi
ecaa62010a drivers/can/mcp2515.c Fix Configure Spi Bus on every bus lock 2023-05-27 03:18:31 +08:00
Lucas Saavedra Vaz
5f1dca63ae arch/xtensa/esp32: Add missing SPI Flash ROM functions
Add missing ROM functions and clear source files
2023-05-27 03:16:20 +08:00
raiden00pl
b9f9ba2600 boards/nrf52840-dongle: add usb support and usbnsh example
This board is designed to work as a USB dongle, from now it is possible.
2023-05-27 03:15:40 +08:00
TimJTi
c904b16cd9 Rename touchscreen ioctls for clarity 2023-05-26 22:42:57 +08:00
Stuart Ianna
a05e8fd9ff binfmt/elf: Support loading fully linked executables.
The following changes make it possible for Nuttx to load binaries in ELF format which are fully linked.

The change does not include the necessary modifications to produce such binaries. In order to build an applicable binary:
 - The userspace applications linker script (`gnu-elf.ld`) needs to modified so the data and text section origin's match those setup by the address environment.
 - The makefile used, in `apps/import/Make.defs` needs to remove the `-r` LDELFFLAG.
2023-05-26 10:37:45 -03:00
TimJTi
c12a122663 Add touchscreen calibration IOCTLs, necessary structs, and implement for ATSAMA5D2
CI error
2023-05-26 13:47:41 +08:00
jinxiuxu
653ea69927 nuttx/audio: add channels range
use the upper 4bits in ac_channels to indicate the minimum channels.

Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2023-05-26 09:34:30 +08:00
chao an
ff6f280b95 Documentation/coredump: add coredump chapter
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-26 09:33:42 +08:00
paolovolpi
8b27e455b1 drivers/can/mcp2515.c Fix Missing Chipselect de-assert before bus unlocking 2023-05-25 18:55:07 -03:00
fangpeina
0b8d5e993d drivers/lcd: Add JD9851 driver
Added support for the JD9851 TFT controller based on ST7789

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2023-05-26 02:21:25 +08:00
jianglianfang
73832ab0a4 vnc server: Fix that vnc_updater thread exited caused by readed a null data
When updating the full-screen data, sq_ init() will clear the updqueue and add just one new full-screen data to the updqueue. So when the vnc_updater thread is awakened, it may read a null data due to multiple reading, leading to vnc_updater thread exited , which is not expected.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-05-25 22:41:47 +08:00
raiden00pl
e06ce27f56 boards/nrf5340-dk: add mx25 memory support
From now on-board QSPI memory is supported.
2023-05-25 22:41:34 +08:00
raiden00pl
8b89730e61 arch/nrf53: add QSPI support 2023-05-25 22:41:34 +08:00
raiden00pl
5ff6c8b403 arch/nrf53: add HFCLK192M clock support
The HFCLK192M clock is required for QSPI to work
2023-05-25 22:41:34 +08:00
raiden00pl
8943d528fd arch/nrf52: add an option to configure QSPI sampling delay for RX data
The default RX delay value may not be suitable for high QSPI frequencies
2023-05-25 22:39:16 +08:00
chao an
6f87bcc9ac sabre-6quad/coredump: add coredump config to enable ci check
How to setup coredump ?

1. Build config coredump:

  $ ./tools/configure.sh ./boards/arm/imx6/sabre-6quad/configs/coredump
  $ make

2. Run qemu and get the coredump snapshot:

  $ qemu-system-arm -semihosting -M sabrelite -m 1024 -smp 4 -nographic -kernel ./nuttx -s
  ABCDGHIJKNOPQ

  NuttShell (NSH) NuttX-10.4.0
  nsh> coredump
  [CPU0] [ 6] Start coredump:
  [CPU0] [ 6] 5A5601013D03FF077F454C4601010100C0000304002800C00D003420036000070400053400200008200A4000000420030034C024200001D8092004E00200601A
  [CPU0] [ 6] 060C0000E85D831040030018200E400300072003403C601F06100000F8518310400340574003E0041F00142003025683106003A000E0081F005A201B4003A000
  [CPU0] [ 6] E0071F03987F831040030060200E4003E0041F209003288A8310400300B820104003E0041F061C0000D09283104003609C2003C01F00202006007C2003000320
  [CPU0] [ 6] 0308435055302049444C45200BE02700E0333BE01B0040A70094200340CFE0576BE0070040730006200340000424A782101420030474A482102020074137400B
  [CPU0] [ 6] 0030200B4027422309F51880108E8A80107F0161AA600040BFE102670031E01FBF4053E00300E0233BE02B0040A7E10267E02C6B403BE05700436B019319A167
  [CPU0] [ 6] 200F20005A560100A703FF010000200000202003007C20030003200308435055322049444C45200BE0170000022003E00300E0233BE02B0040A7009420030001
  [CPU0] [ 6] 2003E02F6BE007B3E04C00025683102005E0080040BFE102670033E01FBF402FE00300E0233BE02B0040A7E10267E02C6BE007B3E04C00005AE1196706687077
  [CPU0] [ 6] 6F726B00E01CBF00042003E00300A03BE0500040A7C167A06BE01CA7E00300E007B3E0170042FF05BC748310785C213B00005A560100F303FF0A000074A48210
  [CPU0] [ 6] 38748310242007010100E00D0008987F8310998C8010A4200303FF000020201260004008007C200300032003076E73685F6D61696E200AE0180000052003E003
  [CPU0] [ 6] 00E0233BE02B0040A70094200340DFE02F6BE007B3E0170000022003078480831088998310200A0200F08E2007200FC1674003400004CC8A8310042007006420
  [CPU0] [ 6] 030028200BE1176707636F726564756D70200AE0180000062003E00300E0233BE02B0040A7C167E02F6BE007B3E017000BDC458310E0988310780A0000415B03
  [CPU0] [ 6] 6C9A8310416B408B4133408F01788F217BA000405F00B0202F02EB21816003035F0000602012E0EB000100005A5601002103FF0E000000005E831000A27C3F00
  [CPU0] [ 6] 005080200DE0FF00E0FF00E0FF00E0CA000100005A5601001203FF010000E0FF00E0FF00E0FF00E0DA000100005A5601005403FF01000020000838748310D037
  [CPU0] [ 6] 8310DF200B0487328010C8200B400F400720120000400B00AB2017005F200B04432B80101520030002200B0101012004E00600028137806033E0FF00E0FF00E0
  [CPU0] [ 6] FF00E083000100005A560100F203FF010000600007808310BC8F8310DF200A088732801084FFFFFFA0200F0006200F04848A83105F200704E92D8110F1200340
  [CPU0] [ 6] 1303108C8310202200FF200A0900988E8310FD248010F7A01B061BD3801054AC826033C0004023403304CDD2801001200FE00300030FA2801020061200C15080
  [CPU0] [ 6] 103081821089678010A18E8310B35CE0092B400F0333EC8010404F4003200EE0640040C34003407B0D08F781107F7B801071F28010A99480C340000291938060
  [CPU0] [ 6] 2340AB4003400B05A1928010F883E005AF01F99080DF40174003009DA00F00642003400F0071A00F013F692063200B018D37E00163E0FF00E0FF00E02E000100
  [CPU0] [ 6] 005A5601003A03FF010000600003589083102006E0080001F092801707636F726564756D70200A600003EFBEADDEE0FF03E0FF03E0FF03E01B032342E07A0001
  [CPU0] [ 6] 00005A560101C003FF010000E095000BF08E83100927801054AC8210400B201201005F2003400BE00717E0CB0040DBE007E7E00FFF40170055200F0043201720
  [CPU0] [ 6] 0A6023401F4017400006111D8010207183600F047D40831018200B4023E003470794818210D91A8010E0174701E43FE00173403306F49A8310DF4C8160170448
  [CPU0] [ 6] 99831041201704CE1F841002200704CD3F81100C2007049D34811040201B200A05002EF781106C200B008D200B001D201F05893E81107978806F000A200300D8
  [CPU0] [ 6] 204F01D57B800F00882027400300F1E0020F009F202B40434027C06B122F798010789B8310F803000008040000C89683600F04277A80108C200700BC2037202A
  [CPU0] [ 6] 01008F202B20060200D092200F000820082003006C20470730A7821000FCFFFF201160000533208110D0072008201F410340230020202301B12220BB200B2019
  [CPU0] [ 6] 010006200301992420DF0323000001200B01001C805740034037400340420000208F60000504000534002040166000046BE88110F0213F200A000040AB00FF20
  [CPU0] [ 6] 0000E120E7400B020B188160174000400F201A00FF402B048517811065200340FB201260B000FD203303F7528110408300A9A00700E84083E00200033F698010
  [CPU0] [ 6] 401B018D37814720005A5601000800090100006000010000
  [CPU0] [ 6] Finish coredump (Compression Enabled).

3. Copy the hex body and save to file:

  $ cat elf.dump
  [CPU0] [ 6] 5A5601013D03FF077F454C4601010100C0000304002800C00D003420036000070400053400200008200A4000000420030034C024200001D8092004E00200601A
  ...
  [CPU0] [ 6] 401B018D37814720005A5601000800090100006000010000

4. Run tools/coredump.py to convert hex dump to elf coredump:

  $ ./tools/coredump.py elf.dump
  Chunk #1 is compressed, 317 bytes (original size: 1023 bytes)
  ...
  Chunk #10 is compressed, 8 bytes (original size: 9 bytes)

  $ ls elf.core
  elf.core

5. Pass core(elf.core) and bin elf(nuttx) to gdb:
  !!(Toolchain(arm-none-eabi-gdb) version must be newer than 11.3) !!

  $ arm-none-eabi-gdb -c elf.core nuttx
  GNU gdb (Arm GNU Toolchain 11.3.Rel1) 12.1.90.20220802-git
  ...
  Reading symbols from nuttx...

  [New process 6]
  [New process 1]
  [New process 2]
  [New process 3]
  [New process 4]
  [New process 5]
  [New process 6]
  Core was generated by `'.
  #0  0x10808a8e in up_idle () at chip/imx_idle.c:61
  61	}
  [Current thread is 1 (process 6)]
  (gdb)
  (gdb) info thread
    Id   Target Id         Frame
  * 1    process 6         0x10808a8e in up_idle () at chip/imx_idle.c:61
    2    process 1         0x10808a8e in up_idle () at chip/imx_idle.c:61
    3    process 2         0x00000000 in ?? ()
    4    process 3         0x00000000 in ?? ()
    5    process 4         up_switch_context (tcb=0x1082a474 <g_idletcb>, rtcb=rtcb@entry=0x10837438) at common/arm_switchcontext.c:95
    6    process 5         up_switch_context (tcb=0x10838ef0, rtcb=rtcb@entry=0x10838000) at common/arm_switchcontext.c:95
    7    process 6         elf_emit_tcb_note (cinfo=0x10839a6c, tcb=0x10838ef0) at libelf/libelf_coredump.c:272
  (gdb) thread 6
  [Switching to thread 6 (process 5)]
  #0  up_switch_context (tcb=0x10838ef0, rtcb=rtcb@entry=0x10838000) at common/arm_switchcontext.c:95
  95	      arm_switchcontext(&rtcb->xcp.regs, tcb->xcp.regs);
  (gdb) bt
  #0  up_switch_context (tcb=0x10838ef0, rtcb=rtcb@entry=0x10838000) at common/arm_switchcontext.c:95
  #1  0x10803286 in nxsem_wait (sem=0x10838fbc) at semaphore/sem_wait.c:176
  #2  0x10812de8 in nxsched_waitpid (pid=pid@entry=6, stat_loc=stat_loc@entry=0x10838a84, options=options@entry=4) at sched/sched_waitpid.c:169
  #3  0x10812df6 in waitpid (pid=pid@entry=6, stat_loc=stat_loc@entry=0x10838a84, options=options@entry=4) at sched/sched_waitpid.c:639
  #4  0x1080d31a in nsh_builtin (vtbl=vtbl@entry=0x10838c10, cmd=0x10838e98 <error: Cannot access memory at address 0x10838e98>, argv=argv@entry=0x10838adc, redirfile=redirfile@entry=0x0, oflags=oflags@entry=0) at nsh_builtin.c:162
  #5  0x1080a20e in nsh_execute (oflags=0, redirfile=0x0, argv=0x10838adc, argc=1, vtbl=0x10838c10) at nsh_parse.c:641
  #6  nsh_parse_command (vtbl=vtbl@entry=0x10838c10, cmdline=<optimized out>) at nsh_parse.c:2742
  #7  0x1080a510 in nsh_parse (vtbl=vtbl@entry=0x10838c10, cmdline=cmdline@entry=0x10838e98 <error: Cannot access memory at address 0x10838e98>) at nsh_parse.c:2826
  #8  0x10809390 in nsh_session (pstate=0x10838c10, login=login@entry=1, argc=argc@entry=1, argv=argv@entry=0x108383f8) at nsh_session.c:245
  #9  0x108090f8 in nsh_consolemain (argc=argc@entry=1, argv=argv@entry=0x108383f8) at nsh_consolemain.c:71
  #10 0x1080909c in nsh_main (argc=1, argv=0x108383f8) at nsh_main.c:74
  #11 0x1080693e in nxtask_startup (entrypt=0x10809071 <nsh_main>, argc=1, argv=0x108383f8) at sched/task_startup.c:70
  #12 0x1080378c in nxtask_start () at task/task_start.c:134
  #13 0x00000000 in ?? ()
  Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 20:42:04 +08:00
chao an
6fdb8b8a66 tools/coredump: add coredump python parser
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 20:42:04 +08:00
chao an
86bf7d9bec sched/misc: Add support for coredump in assert
Add coredump support to collect the stacks and registers of all threads when asserting

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 20:42:04 +08:00
Ville Juven
e0f4a76d6c fs_poll: Fix wrong return value in CONFIG_BUILD_KERNEL
The exit condition below does not work:

  if (ret < 0)
    {
      set_errno(-ret);
      return ERROR;
    }
  else
    {
      return count;
    }
2023-05-25 20:41:20 +08:00
Huang Qi
84c7a4dd69 libc.csv: Correct type of return value for strstr
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-25 20:09:27 +08:00
Michael Jung
efa2a95163 Update stm32l562e-dk:nsh
- Update TrustedFirmare-M instructions to latest version of STM32CubeL5
- Increase idle thread stack size to not overflow during system init
- Select ARCH_HAVE_TRUSTZONE for STM32L5
- Set CONFIG_ARCH_TRUSTZONE_NONSECURE for stm32l562e-dk:nsh, since NuttX
  is running in the Non-secure world.

See https://github.com/apache/nuttx/issues/9316

Signed-off-by: Michael Jung <michael.jung@secore.ly>
2023-05-25 16:04:30 +08:00
chao an
e51ec54c02 stream/hexdump: add hexdump stream to dump binary to syslog
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
Xiang Xiao
0203839fa1 stream: Add syslogstream implementation
which forward the output to syslog

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
Xiang Xiao
20ea607bd0 stream: Rename syslogstream to syslograwstream
to prepare a new stream implementation of syslog

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00