sim/sim_doirq.c: In function 'sim_doirq':
Error: sim/sim_doirq.c:79:10: error: function may return address of local variable [-Werror=return-local-addr]
79 | return regs;
| ^~~~
sim/sim_doirq.c:44:14: note: declared here
44 | xcpt_reg_t tmp[XCPTCONTEXT_REGS];
| ^~~
Signed-off-by: ligd <liguiding1@xiaomi.com>
Previously, it was impossible to build for PIC32MZ architecture with
CONFIG_SERIAL_TERMIOS because it introduced compiler errors in the
lower half driver.
Fixing the compiler errors and adding an implementation of the
TIOCSERGSTRUCT, TCGETS, and TCSETS ioctl calls.
* arch/mips/src/pic32mz/pic32mz_serial.c
(): Include nuttx/fs/ioctl.h, needed for the TIOCSERGSTRUCT, TCGETS,
and TCSETS defines.
(up_ioctl): Fix compile breakage. Implement TIOCSERGSTRUCT. Make
TCGETS return data bits, parity, and stop bits. Make TCSETS apply
changes to data bits, parity, and stop bits.
In the lower half UART driver for Tiva architecture (TM4C12x), adding
the TIOCxBRK ioctl calls, which allow an application to transmit a BSD
compatible line BREAK. TIOCSBRK starts the BREAK and TIOCCBRK ends it.
This architecture supports BSD-style BREAK in hardware. We write to
the BRK bit (bit 0) of the UART Line Control register (UARTLCRH) to
start the BREAK, which begins after the UART finishes shifting out the
current character in progress, if any, including its stop bit(s), and
continues indefinitely until we write to the BRK bit again to stop the
BREAK.
* arch/arm/src/tiva/Kconfig
(config TIVA_UART_BREAKS): New. Appears as CONFIG_TIVA_UART_BREAKS
in code.
* arch/arm/src/tiva/common/tiva_serial.c
(struct up_dev_s): Add new field 'brk' to indicate line break in
progress when built with CONFIG_TIVA_UART_BREAKS.
(up_ioctl): Add cases for TIOCSBRK to turn BSD-compatible break on
unconditionally and TIOCCBRK to turn break off unconditionally.
(up_txint): Block enabling TX interrupt if line break in progress.
This is similar to the STM32F7 implementation.
SOCK_CTRL is added to provide special control over network drivers
and daemons. Currently, SOCK_DGRAM and SOCK_STREAM perform this control,
but these use socket resources. In the case of usersocket in particular,
this is a waste of the device's limited socket resources.
(0)Allocating 3 bytes aligned to 0x00000001
=================================================================
==1461685==ERROR: AddressSanitizer: invalid alignment requested in posix_memalign: 1, alignment must be a power of two and a multiple of sizeof(void*) == 4 (thread T0)
#0 0xf7ab1c2f in __interceptor_posix_memalign ../../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:226
Signed-off-by: ligd <liguiding1@xiaomi.com>
Fix:
```
serial/serial.c: In function 'uart_ioctl':
Error: serial/serial.c:1397:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
1397 | FAR struct termios *termiosp = (FAR struct termios *)arg;
| ^
Error: serial/serial.c:1419:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
1419 | FAR struct termios *termiosp = (FAR struct termios *)arg;
|
```
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Enable the behavior by default for console,
but configurable by termios.
Binary size:
Before:
text data bss dec hex filename
326460 409 8164 335033 51cb9 nuttx/nuttx
After:
text data bss dec hex filename
326478 409 8164 335051 51ccb nuttx/nuttx
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
* arch/arm/src/tiva/common/tiva_serial.c:
(up_ioctl): PR #8406 (commit 1edec0aaa1) added support for
configuring the serial port's CTS/RTS flow control at runtime using
termios when built with CONFIG_SERIAL_TERMIOS and either or both of
CONFIG_SERIAL_OFLOWCONTROL and CONFIG_SERIAL_IFLOWCONTROL. However,
a runtime sanity check left over from before prevented this from
working: When processing ioctl TCSETS, we would return -EINVAL if
one or both of CCTS_OFLOW and CRTS_IFLOW were requested, which was
not deserved if the requested features were in fact supported.
Fixing the sanity check so it depends on features actually
configured.
Fixing an issue that occurred When building with the
Sourcery CodeBench Lite MIPS Toolchain for Linux
(CONFIG_MIPS32_TOOLCHAIN_SOURCERY_CODEBENCH_LITE).
The function is not relevant any longer, remove it. Also remove
save_addrenv_t, the parameter taken by up_addrenv_restore.
Implement addrenv_select() / addrenv_restore() to handle the temporary
instantiation of address environments, e.g. when a process is being
created.
There is currently a big problem in the address environment handling which
is that the address environment is released too soon when the process is
exiting. The current MMU mappings will always be the exiting process's, which means
the system needs them AT LEAST until the next context switch happens. If
the next thread is a kernel thread, the address environment is needed for
longer.
Kernel threads "lend" the address environment of the previous user process.
This is beneficial in two ways:
- The kernel processes do not need an allocated address environment
- When a context switch happens from user -> kernel or kernel -> kernel,
the TLB does not need to be flushed. This must be done only when
changing to a different user address environment.
Another issue is when a new process is created; the address environment
of the new process must be temporarily instantiated by up_addrenv_select().
However, the system scheduler does not know that the process has a different
address environment to its own and when / if a context restore happens, the
wrong MMU page directory is restored and the process will either crash or
do something horribly wrong.
The following changes are needed to fix the issues:
- Add mm_curr which is the current address environment of the process
- Add a reference counter to safeguard the address environment
- Whenever an address environment is mapped to MMU, its reference counter
is incremented
- Whenever and address environment is unmapped from MMU, its reference
counter is decremented, and tested. If no more references -> drop the
address environment and release the memory as well
- To limit the context switch delay, the address environment is freed in
a separate low priority clean-up thread (LPWORK)
- When a process temporarily instantiates another process's address
environment, the scheduler will now know of this and will restore the
correct mappings to MMU
Why is this not causing more noticeable issues ? The problem only happens
under the aforementioned special conditions, and if a context switch or
IRQ occurs during this time.
Detach the address environment handling from the group structure to the
tcb. This is preparation to fix rare cases where the system (MMU) is left
without a valid page directory, e.g. when a process exits.
1.
net/slip.c:865:29: warning: unused variable ‘priv’ [-Wunused-variable]
865 | FAR struct slip_driver_s *priv =
| ^~~~
net/slip.c: In function ‘slip_rmmac’:
net/slip.c:895:29: warning: unused variable ‘priv’ [-Wunused-variable]
895 | FAR struct slip_driver_s *priv =
| ^~~~
2.
local/local_sendmsg.c: In function ‘local_sendmsg’:
local/local_sendmsg.c:423:18: warning: ‘count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
423 | return count;
| ^~~~~
local/local_sendmsg.c:131:11: warning: ‘i’ may be used uninitialized in this function [-Wmaybe-uninitialized]
131 | while (i-- > 0)
| ~^~
local/local_sendmsg.c:71:7: note: ‘i’ was declared here
71 | int i;
| ^
Signed-off-by: chao an <anchao@xiaomi.com>
1.
ipfrag/ipv4_frag.c: In function ‘ipv4_fragin’:
ipfrag/ipv4_frag.c:184:22: warning: ‘head’ may be used uninitialized in this function [-Wmaybe-uninitialized]
184 | ipv4->len[1] = head->io_pktlen & 0xff;
| ~~~~^~~~~~~~~~~
ipfrag/ipv4_frag.c:123:21: note: ‘head’ was declared here
123 | FAR struct iob_s *head;
| ^~~~
2.
devif/ipv6_input.c: In function ‘ipv6_in’:
devif/ipv6_input.c:60:33: error: ‘TCPIPv6BUF’ undeclared (first use in this function); did you mean ‘UDPIPv6BUF’?
60 | #define PAYLOAD ((FAR uint8_t *)TCPIPv6BUF)
| ^~~~~~~~~~
3.
nat/ipv4_nat.c: In function ‘ipv4_nat_inbound_icmp’:
nat/ipv4_nat.c:67:30: error: ‘TCP_HDRLEN’ undeclared (first use in this function); did you mean ‘UDP_HDRLEN’?
67 | ((proto) == IP_PROTO_TCP ? TCP_HDRLEN : \
| ^~~~~~~~~~
nat/ipv4_nat.c:323:47: note: in expansion of macro ‘L4_HDRLEN’
323 | inner_l4hdrlen = MIN(inner_l4len, L4_HDRLEN(inner->proto));
| ^~~~~~~~~
Signed-off-by: chao an <anchao@xiaomi.com>
The cyw43-driver is a submodule in the pick-sdk, if the submodule is
not updated, the dummy firmware driver will be used, update the document
to correct the setup flow.
${PICO_SDK_PATH}/lib/cyw43-driver/firmware/43439A0-7.95.49.00.combined
Signed-off-by: chao an <anchao@xiaomi.com>
ld: warning: boards/arm/rp2040/raspberrypi-pico-w/scripts/raspberrypi-pico-flash.ld contains output sections; did you forget -T?
Signed-off-by: chao an <anchao@xiaomi.com>