Commit Graph

45398 Commits

Author SHA1 Message Date
Petro Karashchenko
7a6253cb89 arch/arm/samv7: Fix PWM operation for single channel mode
The current SAMv7 PWM driver assumes that all PWM channels should
work in sync mode, but that is a partial case of a generic PWM
driver operation.

Start SAMv7 PWM channels in async mode. The sync mode should be
implemeted either using ioctl command or via a separate Kconfig
option.

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-05-24 03:26:13 +08:00
Eero Nurkkala
3ea7d4bab4 risc-v/mpfs: amend OpenSBI to utilize IHC
Linux kernel uses M-mode trap for handling Inter-Hart Communication (IHC).
This patch provides all the required functionalities for this purpose.
Previously, HSS bootloader was required. Now, NuttX is run as the
bootloader providing OpenSBI vendor extensions instead. This setup has
been tested on the following configuration:

 - Hart 0 has NuttX in bootloader mode with OpenSBI
 - Hart 1 unused
 - Hart 2 has NuttX configured at 0xa2000000
 - Hart 3 has U-boot / Linux kernel (at 0x80200000)
 - Hart 4 has U-boot / Linux kernel (at 0x80200000)

Upon startup, NuttX on hart 0 will initialize SD-card driver, loads
the hart 2 NuttX from the SD-card and loads the U-boot to 0x80200000.
Also the nuttx.sbi -binary is loaded from SD-card into address 0x80000000,
which is also marked as reserved area in the Linux kernel device tree (for
the chuck 0x80000000 - 0x80200000).

Hart 2 NuttX waits until Linux kernel (IHC master) is started. After the
initial handshake, RPMsg / virtIO bus along with the IHC may be used for
proper AMP mode.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-05-24 03:25:37 +08:00
Masayuki Ishikawa
84bcb075d7 arch: risc-v: Fix crt0.c if CONFIG_HAVE_CXX is not set
Summary:
- I noticed that rv-virt:knsh64 crashes when it executes the init.
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested with rv-virt:knsh64

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-05-23 21:19:01 +08:00
wangbowen6
200109fd28 arm/tlsr82: optimize the adc driver.
1. Add vbat mode for chip internal voltage sample;
2. Add adc channel config;
3. Using DFIFO2 to get the sample value, follow telink sdk.
4. Add calibration function and config;

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-05-22 23:10:06 +08:00
Ville Juven
621062dc1d MPFS: Implement S-mode head and start function
- Remove S-mode initializations from the M-mode head file, they are not
  required
- Writing mstatus->tvm from S-mode will result in illegal instruction
2022-05-22 15:42:30 +03:00
YAMAMOTO Takashi
5edf5e5585 mm: Add CONFIG_MM_PANIC_ON_FAILURE option
While allocation failure here is not necessarily abnormal enough to
warrant a panic in general, it can be useful in certain situations.
2022-05-21 14:28:41 +08:00
YAMAMOTO Takashi
b05320cac2 mm: Move backtrace stuff into a separate option
The functionality has too much overhead for CONFIG_DEBUG_MM.
2022-05-21 14:28:41 +08:00
YAMAMOTO Takashi
c546c0b647 mm: Do not abort on allocation failue with CONFIG_DEBUG_MM
When allocation failed, it isn't too uncommon for the caller
to fall back to other allocation method.
(eg. esp32 textheap code tries iram heap when an allocation from rtc heap
failed.)
DEBUGASSERT(false) is too much in that case.

This commit removes the DEBUGASSERT, and also makes the heap dump
a separate option.
2022-05-21 14:28:41 +08:00
Karel Kočí
2f03b42bfc boards: arm: kl: keep cfmconfig sections in linker script
This makes sure that this section is present even if LTO is enabled.
2022-05-21 00:03:03 +08:00
Karel Kočí
a74c707da6 arch: arm: armv6-m: fix LTO build
This imports changes from armv7-m.
2022-05-21 00:03:03 +08:00
YAMAMOTO Takashi
f2bc4555bb kmalloc.h: Add kmm_heapmember for !CONFIG_MM_KERNEL_HEAP case 2022-05-20 21:16:42 +08:00
YAMAMOTO Takashi
0b547e2384 esp32: Implement up_textheap_heapmember 2022-05-20 21:16:42 +08:00
YAMAMOTO Takashi
c60bb81387 esp32c3: Implement up_textheap_heapmember 2022-05-20 21:16:42 +08:00
YAMAMOTO Takashi
a9317b1895 cxd56xx: Implement up_textheap_heapmember 2022-05-20 21:16:42 +08:00
YAMAMOTO Takashi
35a5cc27ac include/nuttx/arch.h: Add up_textheap_heapmember 2022-05-20 21:16:42 +08:00
YAMAMOTO Takashi
de27cfeec7 kmalloc.h: Remove extra semicolons 2022-05-20 21:13:21 +08:00
Xiang Xiao
ba6ee2a407 pthread/spinlock: Call up_testsest directly in the flat build
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-20 09:51:53 -03:00
YAMAMOTO Takashi
0a1ac4762a littlefs_stat: Fix directory size
lfs_info.size is only valid for LFS_TYPE_REG.
For directory, use 0 instead of stack garbage.
2022-05-20 15:37:28 +03:00
Ville Juven
91063e85f0 risc-v/vfork: FPU was not saved correctly
The FPU register saving upon vfork entry was missing.

Also added macro that tells the actual size of an FPU reg, instead
of just having a coefficient for qfpu/no-qfpu.
2022-05-20 15:59:24 +08:00
Xiang Xiao
b39d70fe25 libxxmini: Fix error: use of undeclared identifier 'nullptr'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 23:23:01 +03:00
Xiang Xiao
efc863217b Fix error: converting the result of '<<' to a boolean always evaluates to true
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 23:23:01 +03:00
Xiang Xiao
1067b6afc9 boards/sim: Remove the unnecessary CONFIG_SIM_M32
to enable build on macOS

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 23:23:01 +03:00
Xiang Xiao
ce7113387b board/sim: Enable hellocxx in loadable config
to test the support of C++ ELF binary

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 23:23:01 +03:00
Xiang Xiao
9d2dae2fd8 sched/wqueue: Add work_timeleft macro to get the left time to start
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 23:21:54 +03:00
Xiang Xiao
5b0b4bd586 sched/wdog: Change the return type of wd_gettime from int to sclock_t
to handle 64bits sclock_t correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 23:21:54 +03:00
Xiang Xiao
753aa98ca7 net/tcp: Zero keeptimer in case caller set keepalive to false
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-19 09:08:36 -03:00
Ville Juven
1ec70bc704 risc-v/vfork: Save FPU registers
Save the callee saved FPU registers
2022-05-19 09:05:00 -03:00
Ville Juven
ef42b7c31e risc-v/irq: Add ABI name versions of FPU registers 2022-05-19 09:05:00 -03:00
Ville Juven
ec073d91c7 risc-v/vfork: Save correct amount of registers for vfork
The original code does not obey RISC-V calling conventions, looks like
it was copy&pasted from MIPS instead.
2022-05-19 09:05:00 -03:00
jihandong
89338a6914 sched/pthread/pthread_condclockwait.c: follow POSIX.
pthread_condclockwait() can not distinguish between interrupt and timeout,
which cause these API not follow POSIX:
	pthread_rwlock_timedrdlock()
	pthread_rwlock_timedwrlock()
	pthread_condtimedwait()
POSIX:
	Upon return from the signal handler the thread resumes waiting for
	the condition variable as if it wasnot interrupted
	These functions shall not return an error code of [EINTR].

Replacing nxsem_wait() with nxsem_clockwait_uninterruptible() can solve it.

Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-05-19 14:57:33 +08:00
Sebastien Lorquet
517f179f8d stm32h7: Adds the ability to choose the HSI divider, which must be indicated in board.h if used. 2022-05-18 11:59:07 -07:00
Ville Juven
12476e1f43 RISC-V: add C++ support to crt0 2022-05-19 01:35:36 +08:00
zhuyanlin
b71a1f77c3 xtensa: add perf counter
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-05-18 19:11:32 +03:00
Xiang Xiao
d8b97d7ae8 net/tcp: Use the relative value for keep alive timer
unify the timer process logic as other tcp state

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-18 18:40:41 +03:00
Xiang Xiao
2d3ee157ce net/tcp: Use the decrease timer in TCP_TIME_WAIT/TCP_FIN_WAIT_2
unify the timer process logic as other tcp state

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-18 18:40:41 +03:00
Gustavo Henrique Nihei
aefe78a884 xtensa: Add missing input operand on sys_call6 inline ASM
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-05-18 15:46:57 +02:00
Xiang Xiao
b30e0a26ef Move "-nostartfiles -nodefaultlibs" from Make.defs to Toolchian.defs
and replace "-nostartfiles -nodefaultlibs" with "-nostdlib"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-18 08:26:02 -04:00
Ville Juven
d7f7867f76 risc-v/opensbi: Generalize the SBI variable handling in makefile
- Remove most of the ifeq-conditions and replace them with variables.
- Move the -I flag for 3rd party headers to opensbi/Make.defs

This clean-up / generalization makes it much simpler to add a new SBI
implementation, without the need to add a bunch of ifeq / elif conditions
to the makefile.
2022-05-18 08:35:04 -03:00
Gustavo Henrique Nihei
4f31c89963 esp32c3-devkit: Rename linker script to indicate use for Flat mode
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-05-18 11:43:52 +08:00
Gustavo Henrique Nihei
c778f35f08 risc-v/esp32c3: Add support for Protected Mode
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-05-18 11:43:52 +08:00
Sebastien Lorquet
6ea8bac1c5 net: fix the build when CONFIG_NET_TCP_WRITE_BUFFERS is not enabled 2022-05-18 07:54:17 +09:00
Xiang Xiao
6642741612 timers/watchdog: Ensure it's the idle domain before keepalive
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-17 22:57:52 +03:00
gaojiawei
335fc3dde2 syslog: Fixed a potential buffer overflow issue
The `CONFIG_SYSLOG_MAX_CHANNELS` is user-specified, however, if the user
defines more channels than what `CONFIG_SYSLOG_MAX_CHANNELS` was defined as,
a potential buffer overflow occurred. Although the compiler does warn us about
that, we should explicitly tell the user this is an error.

Signed-off-by: gaojiawei <gaojiawei@xiaomi.com>
2022-05-18 01:36:16 +08:00
Eero Nurkkala
817919ebb6 risc-v/mpfs: IHC: allow hart configuration
Let the user pick what runs on the harts. For example, the
default configuration now supports NuttX on hart2 and Linux
kernel on harts 3 and 4. Also fix a few issues in the code.

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
2022-05-18 01:34:33 +08:00
Abdelatif Guettouche
53cf328cbe xtensa.h: Remove old prototype.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2022-05-18 01:07:48 +08:00
Ville Juven
c2d179a2f4 arch/addrenv: Add missing FAR qualifier to addrenv_mprot 2022-05-17 11:12:57 +02:00
Abdelatif Guettouche
06f2c67fc2 xtensa.h: Remove old prototype.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2022-05-16 23:38:09 +08:00
Adam Kaliszan
fb3d080fd1 NucleoF401RE Oled
Stm NucleoF401RE supports SSD1306 oled display on SPI bus.
2022-05-16 11:43:28 -03:00
zhuyanlin
883337c3a0 xtensa:fpu: add up_fpucmp and enable CONFIG_ARCH_FPU macro
For arch with CP_NUM > 0, enable ARCH_FPU

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-05-16 12:30:39 +03:00
Xiang Xiao
5958d3ac62 risc-v: Move "LDFLAGS += -melf32lriscv" from Make.defs to Toolchain.defs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-16 11:17:08 +03:00