This implements empty hooks to the arch/chip layer, which can implement
an optional translation between logical<->physical CPU/core id.
The default mapping is 1:1 i.e. logical=physical.
The function is supposed to return the physical hart ID. It is needed
for e.g. external interrupt acknowledgment (see mpfs_plic.c).
This offset is moved initially to up_cpu_index (which is also wrong, but
less wrong than the current implementation). Finally, a translation
between physical <-> logical shall be provided.
This fixes issue where empty and unallocated sections are left without
a VMA. Some relocations depend on the section VMA being set even if there
is no data there, as the binary can refer to the symbols. Linker defined
symbols do not contain data -> they can produce empty sections.
This issue is seen when building a loadable file which declares _sctors /
_sdtors linker defined symbols for ctor/dtor sections which are empty.
crt0 references these symbols, so they need to be relocated, but the
section VMA is not set -> they go outside of the addressable range of the
user binary causing a potential crash.
this_task obtains the CPU ID through the GS register, so the initial value of GS needs to be configured in x86_64_cpu_priv_set
Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
x86_64/intel64: fix SMP compilation warnings
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Implement PIC loading in armv8-m qemu,
for example: load address-independent AP ELF in the bootloader,
and the text segment in AP ELF is XIP,
no need to apply for memory and modify it.
Two config:
bootloader abbreviation bl:
use romfs to load ap elf, use the boot command to parse and jump to ap
application abbreviation ap:
run os test
We need to compile ap first, then compile bl.
compile step:
./tools/configure.sh mps3-an547:ap
make -j20
mkdir -p pic
cp boot pic/.
genromfs -a 128 -f ../romfs.img -d pic
make distclean -j20
./tools/configure.sh mps3-an547:bl
make -j20
run qemu:
qemu-system-arm -M mps3-an547 -m 2G -nographic -kernel nuttx.bin \
-gdb tcp::1127 -device loader,file=../romfs.img,addr=0x60000000
nsh> boot /etc/boot
ap> ostest
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Need to start up a new to setup special registers use
`arm_pic_setupxcp`.
Note that CONFIG_BUILD_PIC compiles the entire NuttX image
as position-independent(PIC), enable CONFIG_PIC to load PIC
application code.
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
The default heap management in nuttx returns a valid memory address when malloc(0).
In sim_heap, malloc(0) returns NULL, aligning the behavior of sim_heap with mm_heap
The man manual describes malloc as follows:
https://man7.org/linux/man-pages/man3/malloc.3.html
The malloc() function allocates size bytes and returns a pointer
to the allocated memory. The memory is not initialized. If size
is 0, then malloc() returns a unique pointer value that can later
be successfully passed to free(). (See "Nonportable behavior"
for portability issues.)
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
In circbuf_get_read/writeptr, when circbuf is full, off == pos, and
*size = off - pos = 0. So add circbuf_is_full() condition to return
correct *size.
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Current 8 bits of uint8_t cannot represent sample rate bigger than
255,change uint8_t to uint32_t to expand sample rate range.
Signed-off-by: wurui3 <wurui3@xiaomi.com>
This has been broken at some point. Just fix it by copying the can frame and
the cmsg data into IOB, and fix devif_poll to copy out the full data.
The can drivers expect to find the timeout timestamp in the end of the frame.
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>