Git Product home page Git Product logo

pikort's Introduction

Piko/RT

This is Piko/RT, a tiny Linux-like real-time operating system kernel, optimized for ARM Cortex-M series microprocessors.

Prerequisites

Run test suite

  • Run all test
$ make PLAT=stm32p103 check
  • Run all test with command line tools
$ python -m tests
  • Run specific test cases
$ python -m tests fs_1 cond_2

External Source

  • scripts/rstlint.py: written by Georg Brandl

pikort's People

Contributors

cwyark avatar jserv avatar kaizsv avatar lecopzer avatar mlouielu avatar quantabase13 avatar yan-kuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pikort's Issues

Broken mutex

HI,
https://github.com/PikoRT/pikoRT/blob/master/kernel/mutex.c#L14

int sys_pthread_mutex_lock(kernel_mutex_t *mutex)
{
    mutex->val++;
    if (!mutex->val)
        return 0;

I'm pretty sure such code is not mutual exclusion.
It better to implement cmpxchg by ldrex or ldxr

Also, the tests for mutext_* are not test for mutual exclusion at all, they only test for the functions finish execution or not.

POSIX PSE51 API requirements

The PSE51 Units of Functionality Requirements:

ref: http://ieeexplore.ieee.org/document/1342418/

Table 1-18 — Units of Functionality Requirements

  • POSIX_ADA_LANG_SUPPORT (ada only)
  • POSIX_C_LANG_JUMP (c only)
  • POSIX_C_LANG_SUPPORT
  • POSIX_DEVICE_IO
  • POSIX_FILE_LOCKING
  • POSIX_SIGNALS
  • POSIX_SINGLE_PROCESS
  • POSIX_THREADS_BASE
  • XSI_THREAD_MUTEX_EXT
  • XSI_THREADS_EXT

Table 1-19 — POSIX.1 Option Requirements

  • _POSIX_CLOCK_SELECTION
  • _POSIX_FSYNC
  • _POSIX_MEMLOCK
  • _POSIX_MEMLOCK_RANGE
  • _POSIX_MONOTONIC_CLOCK
  • _POSIX_NO_TRUNC
  • _POSIX_REALTIME_SIGNALS
  • _POSIX_SEMAPHORES
  • _POSIX_SHARED_MEMORY_OBJECTS
  • _POSIX_SYNCHRONIZED_IO
  • _POSIX_THREAD_ATTR_STACKADDR
  • _POSIX_THREAD_ATTR_STACKSIZE
  • _POSIX_THREAD_CPUTIME
  • _POSIX_THREAD_PRIO_INHERIT
  • _POSIX_THREAD_PRIO_PROTECT
  • _POSIX_THREAD_PRIORITY_SCHEDULING
  • _POSIX_THREAD_SPORADIC_SERVER
  • _POSIX_TIMEOUTS
  • _POSIX_TIMERS
  • _POSIX2_C_DEV
  • _POSIX2_SW_DEV

Invalid 'run' target for STM32F429

The run target defined in file target/stm32f429/build.mk is not really functioned:

run: $(NAME).bin
        $(Q)qemu-system-arm \
            -semihosting \
            $(REDIRECT_SERIAL) \
            -nographic \                                                                                                                                     
            -cpu cortex-m3 \
            -machine stm32-p103 \
            -kernel $<

Since the binary is built for Cortex-M4 with STM32F4-specific peripherals, it is impossible to emulate via the above parameters.

Instead, we can reset STM32F429-derived device by invoking OpenOCD for run target.

Need abstraction for stm32 initialization

The stm32-specific hardware initialization functions, stm32f1_init and stm32f4_init, are implemented in file drivers/serial/stm32f1xx.c and drivers/serial/stm32f4xx.c, that violates the abstraction of initialization flow. We should consider the way how Linux manipulates platform drivers.

Make clean won't clean prebuild

Should make clean remove prebuild?

$ make
....
$ make clean
find . -name "*.o" -type f -delete
find ../cmsis -name "*.o" -type f -delete
rm -f piko.map piko.lds
rm -f piko.elf piko.hex
rm -f piko.bin
$ make prebuild
make: Nothing to be done for 'prebuild'.

Is timer callback function preemptable in softirq?

sched_enqueue(timer->owner);

Softirq is a thread like main or idle in Piko/RT. Is softirq preemptable or tasklet preemptable?

For example, the callback function of msleep will call sched_enqueue. It first adds a thread at the tail of the queue, and then sets the priority level at the unsigned integer, map. If PendSV preempts at the first step and swap the active and expired runqueue because the value of map of active runqueue is zero. This will cause an error.

The GDB says the systick can preempt the softirq, but I can not specify the interrupt point at the softirq. I am wondering, whether the callback function (msleep_callback) is preemptable at the execution time?

stm32-p103 shell command linker script or hook maybe wrong

➜  pikoRT git:(master) ✗ arm-none-eabi-nm piko.elf | grep 0063
00006360 T __rodata_start__  
00006330 t shell_cat         
00006360 T __shell_cmd_end__ 
0000632e T __shell_cmd_start__                            
00006338 t shell_echo        
00006340 t shell_exit        
00006348 t shell_halt        
00006350 t shell_ls          
00006358 t shell_reboot      
00006312 T strchr            
0000632e T __text_end__      

It should be something like this IMO:

0000632e T __shell_cmd_start__                            
00006338 t shell_echo        
00006340 t shell_exit        
00006348 t shell_halt        
00006350 t shell_ls          
00006358 t shell_reboot   
xxxxxxxxx T __shell_cmd_end__ 
00006312 T strchr            
0000632e T __text_end__      

This cause a fatal error in stm32-p103 when executing:

$ ls
qemu: fatal: Trying to execute code outside RAM or ROM at 0x5c690000                                                  

R00=00000001 R01=20008f78 R02=20008f78 R03=5c690000        
R04=6bd80000 R05=00000000 R06=00000000 R07=20008f70        
R08=00000000 R09=00000000 R10=00000000 R11=00000000        
R12=00000000 R13=20008f70 R14=00005f19 R15=5c690000        
PSR=00000153 ---- A svc32    
FPSCR: 00000000              
make: *** [target/stm32p103/Makefile.rules:31: dbg] Aborted (core dumped)                                             

minishell when typing, easily execute code outside RAM or ROM on stm32p103

When running qemu with stm32p103, typing in minishell will easily crash.

Memory map:                  
  .text   = 00000140--000225d0  140432 Bytes               
  .rodata = 00022608--000298ee   29414 Bytes               
  .data   = 20000000--2000051c    1308 Bytes               
  .bss    = 20000520--20001c6c    5964 Bytes               
  .heap   = 20001c80--20009c80   32768 Bytes               
  .pgmem  = 20018000--2001f000   28672 Bytes               
Order  Bitmap                
    0  00000000  00000000  00000000  00000000              
    1  00000000  00000000    
    2  00000000              
    3  00007fff              
Created idle_thread at <0x20018200>                        
Created main_thread at <0x20018800> with priority=31       
Reclaim early stack's physical memory (2048 Bytes, order=3).                                                          
Creating /proc/version       
Creating /proc/meminfo       
Creating /dev/mem            
Creating /dev/null           
Creating /dev/zero           
Creating /dev/random         
Creating MTD device mtd0     
Kernel bootstrap done.       
--                           
Piko version 0.0.0 (grd@louie) (armv7-m, cortex-m4) #Tue Aug 15 10:48:37 2017                                         
arm-none-eabi-gcc (Arch Repository) 7.1.0                  

$ pqemu: fatal: Trying to execute code outside RAM or ROM at 0x79797978                                               

R00=79797979 R01=00000026 R02=00000001 R03=00000000        
R04=00000000 R05=00000000 R06=00000000 R07=20018fd8        
R08=00000000 R09=00000000 R10=00000000 R11=00000000        
R12=00000000 R13=200189fc R14=00000483 R15=79797978        
PSR=00000173 ---- T svc32    
FPSCR: 00000000              
make: *** [target/stm32p103/build.mk:6: run] Aborted (core dumped)                                                    

MacOS make prebuild lsb_release: command not found

$ make prebuild
make: lsb_release: Command not found
svn export --force https://github.com/ARMmbed/mbed-os/trunk/cmsis/ ../cmsis/arm
A    ../cmsis/arm
A    ../cmsis/arm/TARGET_CORTEX_A
A    ../cmsis/arm/TARGET_CORTEX_A/TOOLCHAIN_ARM
A    ../cmsis/arm/TARGET_CORTEX_A/TOOLCHAIN_ARM/cmsis_armcc.h
A    ../cmsis/arm/TARGET_CORTEX_A/TOOLCHAIN_ARM/cmsis_armclang.h
A    ../cmsis/arm/TARGET_CORTEX_A/cmsis_compiler.h
A    ../cmsis/arm/TARGET_CORTEX_A/core_ca9.h

Not sure if this will affect.

Need make twice to make thing work first time

Found this issue

$ make
...
A    ../cmsis/TARGET_STM/pwmout_api.c
A    ../cmsis/TARGET_STM/rtc_api.c
A    ../cmsis/TARGET_STM/rtc_api_hal.h
A    ../cmsis/TARGET_STM/serial_api.c
A    ../cmsis/TARGET_STM/serial_api_hal.h
A    ../cmsis/TARGET_STM/sleep.c
A    ../cmsis/TARGET_STM/stm32_assert.h
A    ../cmsis/TARGET_STM/stm_spi_api.c
A    ../cmsis/TARGET_STM/trng_api.c
A    ../cmsis/TARGET_STM/us_ticker_16b.c
A    ../cmsis/TARGET_STM/us_ticker_32b.c
Exported revision 27126.
mkdir -p ../cmsis/util
wget https://raw.github.com/ARMmbed/mbed-os/master/platform/mbed_preprocessor.h -P ../cmsis/util
--2017-08-09 09:43:37--  https://raw.github.com/ARMmbed/mbed-os/master/platform/mbed_preprocessor.h
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving raw.github.com... 151.101.88.133
Connecting to raw.github.com|151.101.88.133|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/ARMmbed/mbed-os/master/platform/mbed_preprocessor.h [following]
--2017-08-09 09:43:38--  https://raw.githubusercontent.com/ARMmbed/mbed-os/master/platform/mbed_preprocessor.h
Resolving raw.githubusercontent.com... 151.101.88.133
Connecting to raw.githubusercontent.com|151.101.88.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1401 (1.4K) [text/plain]
Saving to: ‘../cmsis/util/mbed_preprocessor.h’

mbed_preprocessor.h                                         100%[========================================================================================================================================>]   1.37K  --.-KB/s    in 0s      

2017-08-09 09:43:39 (16.1 MB/s) - ‘../cmsis/util/mbed_preprocessor.h’ saved [1401/1401]

wget https://raw.github.com/ARMmbed/mbed-os/master/platform/mbed_assert.h -P ../cmsis/util
--2017-08-09 09:43:39--  https://raw.github.com/ARMmbed/mbed-os/master/platform/mbed_assert.h
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving raw.github.com... 151.101.88.133
Connecting to raw.github.com|151.101.88.133|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://raw.githubusercontent.com/ARMmbed/mbed-os/master/platform/mbed_assert.h [following]
--2017-08-09 09:43:40--  https://raw.githubusercontent.com/ARMmbed/mbed-os/master/platform/mbed_assert.h
Resolving raw.githubusercontent.com... 151.101.88.133
Connecting to raw.githubusercontent.com|151.101.88.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4002 (3.9K) [text/plain]
Saving to: ‘../cmsis/util/mbed_assert.h’

mbed_assert.h                                               100%[========================================================================================================================================>]   3.91K  --.-KB/s    in 0s      

2017-08-09 09:43:41 (24.4 MB/s) - ‘../cmsis/util/mbed_assert.h’ saved [4002/4002]

HOSTCC\tpiko.lds
CC\t../cmsis/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/TARGET_DISCO_F429ZI/system_clock.o
AS\tarch/v7m-entry.o
CC\tarch/v7m-faults.o
AS\tarch/v7m-head.o
AS\tarch/v7m-svcall.o
CC\tdrivers/char/mem.o
CC\tdrivers/char/random.o
CC\tdrivers/mtd/mtdchar.o
CC\tdrivers/mtd/mtdcore.o
CC\tdrivers/mtd/mtdram.o
CC\tdrivers/serial/serialchar.o
CC\tdrivers/serial/serialcore.o
CC\tdrivers/serial/stm32f429.o
CC\tdrivers/timer/systick.o
CC\tdrivers/timer/timercore.o
CC\tkernel/bitops.o
CC\tkernel/cbuf.o
CC\tkernel/cond.o
CC\tkernel/config.o
CC\tkernel/faults.o
CC\tkernel/fs/fs.o
CC\tkernel/fs/proc.o
CC\tkernel/fs/readdir.o
CC\tkernel/fs/romfs.o
CC\tkernel/fs/tmpfs.o
CC\tkernel/fs/vfs.o
CC\tkernel/irq.o
CC\tkernel/main.o
CC\tkernel/mm/mm.o
CC\tkernel/mm/page.o
CC\tkernel/mm/slab.o
CC\tkernel/mutex.o
CC\tkernel/printk.o
CC\tkernel/resource.o
CC\tkernel/sched-o1.o
CC\tkernel/sched-rr.o
CC\tkernel/sched.o
CC\tkernel/signal.o
CC\tkernel/softirq.o
kernel/softirq.c: In function 'open_softirq':
kernel/softirq.c:30:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (nr >= NR_SOFTIRQS)
     ^~
kernel/softirq.c:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  softirq_vec[nr].action = action;
  ^~~~~~~~~~~
CC\tkernel/syscall.o
CC\tkernel/task.o
CC\tkernel/thread.o
CC\tkernel/time.o
CC\tlibc/fcntl.o
CC\tlibc/filesystem.o
CC\tlibc/piko/mman.o
CC\tlibc/piko/stubs.o
AS\tlibc/piko/syscalls.o
CC\tlibc/pthread.o
CC\tlibc/signal.o
CC\tlibc/stdio.o
CC\tlibc/stdlib.o
CC\tlibc/time.o
CC\tlibc/ucontext.o
CC\tlibc/unistd.o
CC\tlibc/utils.o
AS\tlibc/v7m-pthread.o
CC\ttarget/stm32f429/halt.o
CC\ttarget/stm32f429/init.o
CC\tuser/cat.o
CC\tuser/echo.o
CC\tuser/exit.o
CC\tuser/halt.o
CC\tuser/ls.o
CC\tuser/reboot.o
CC\tuser/sh.o
user/sh.c: In function 'exec_command':
user/sh.c:44:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (cmd = (struct shell_cmd *) &__shell_cmd_start__;
     ^~~
user/sh.c:52:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  write(fd, TERM_CMD_NOT_FOUND, sizeof(TERM_CMD_NOT_FOUND) - 1);
  ^~~~~
OBJCOPY\tkernel/fs/version.o
LD\tpiko.elf
target/stm32f429/init.o: In function `__printk_init':
/home/grd/kernel/pikoRT/target/stm32f429/init.c:49: undefined reference to `HAL_GPIO_Init'
/home/grd/kernel/pikoRT/target/stm32f429/init.c:78: undefined reference to `HAL_UART_Init'
collect2: error: ld returned 1 exit status
make: *** [Makefile:55: piko.elf] Error 1
$ make
..
CC\tlibc/stdlib.o
CC\tlibc/time.o
CC\tlibc/ucontext.o
CC\tlibc/unistd.o
CC\tlibc/utils.o
AS\tlibc/v7m-pthread.o
CC\ttarget/stm32f429/halt.o
CC\ttarget/stm32f429/init.o
CC\tuser/cat.o
CC\tuser/echo.o
CC\tuser/exit.o
CC\tuser/halt.o
CC\tuser/ls.o
CC\tuser/reboot.o
CC\tuser/sh.o
user/sh.c: In function 'exec_command':
user/sh.c:44:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (cmd = (struct shell_cmd *) &__shell_cmd_start__;
     ^~~
user/sh.c:52:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  write(fd, TERM_CMD_NOT_FOUND, sizeof(TERM_CMD_NOT_FOUND) - 1);
  ^~~~~
OBJCOPY\tkernel/fs/version.o
LD\tpiko.elf
OBJCOPY\tpiko.hex
OBJCOPY\tpiko.bin
$

Idle thread problem in bitmap scheduler

if (next == thread_idle || next == current)

Hello

I'm confused at this part. If both runqueues are empty, the bitmap scheduler will select idle as next thread. But this condition statement causes current thread not to switch to idle thread and returns directly. I replace this line as follows. In cond_2 test case, the gdb will stop at the second line but the 'do_idle' function never been executed. Is there any reason not to perform context switch while next thread is idle?

if (next == current) return 0;
if (next == thread_idle) return 0;

Determine inline documentation generators

I'm looking for appropriate documentation generators which supported including comments from source files. However, there are two candidates on my list. One is the well-known project, Doxygen, and the other one is Linuxdoc, which is a Sphinx extension.

As all we knew, Doxygen is a really powerful and historical documentation tool for not only generating calling graph but also parsing comments annotated in source files. No doubt, it is the first pick.

Linuxdoc is a recently arising project, which is an extension of Sphinx which supports inline documentation in C source files. From 2016, Linux start to migrate documentation tool from DocBook to Sphinx, and is in urgent need of Linuxdoc. Moreover, It also backward compatible with existing docs support by DocBook. More details you could find it on How to write kernel documentation.

I have already tested both of them, and they worked excellently.

Here is a comprehensive comparison report, Comparison of documentation generators, on Wikipedia. It's worth to mention that the license of Doxygen is GPL, and Sphinx is BSD. But Linuxdoc is GPLv2 referred to repo on Github.

Any suggestion is welcome :-)

qemu-system-arm can't run

➜  pikoRT git:(master) ✗ make run

(process:26904): GLib-WARNING **: gmem.c:483: custom memory allocation vtable not supported
STM32_UART: ADC1 clock is set to 0 Hz.
STM32_UART: ADC1 BRR set to 0.
STM32_UART: ADC1 Baud is set to 0 bits per sec.
STM32_UART: ADC2 clock is set to 0 Hz.
STM32_UART: ADC2 BRR set to 0.
STM32_UART: ADC2 Baud is set to 0 bits per sec.
STM32_UART: ADC3 clock is set to 0 Hz.
STM32_UART: ADC3 BRR set to 0.
STM32_UART: ADC3 Baud is set to 0 bits per sec.
STM32_UART: DAC clock is set to 0 Hz.
STM32_UART: DAC BRR set to 0.
STM32_UART: DAC Baud is set to 0 bits per sec.
STM32_UART: TIM1 clock is set to 0 Hz.
STM32_UART: TIM1 BRR set to 0.
STM32_UART: TIM1 Baud is set to 0 bits per sec.
STM32_UART: TIM1 clock is set to 0 Hz.
STM32_UART: TIM1 BRR set to 0.
STM32_UART: TIM1 Baud is set to 0 bits per sec.
STM32_UART: DAC clock is set to 0 Hz.
STM32_UART: DAC BRR set to 0.
STM32_UART: DAC Baud is set to 0 bits per sec.
STM32_UART: ADC3 clock is set to 0 Hz.
STM32_UART: ADC3 BRR set to 0.
STM32_UART: ADC3 Baud is set to 0 bits per sec.
STM32_UART: ADC2 clock is set to 0 Hz.
STM32_UART: ADC2 BRR set to 0.
STM32_UART: ADC2 Baud is set to 0 bits per sec.
STM32_UART: ADC1 clock is set to 0 Hz.
STM32_UART: ADC1 BRR set to 0.
STM32_UART: ADC1 Baud is set to 0 bits per sec.
LED Off
CLKTREE: HSI Output Change (SrcClk:None InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: HSI/2 Output Change (SrcClk:HSI InFreq:8000000 OutFreq:4000000 Mul:1 Div:2 Enabled:1)
CLKTREE: SYSCLK Output Change (SrcClk:HSI InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: HCLK Output Change (SrcClk:SYSCLK InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
STM32_RCC: Cortex SYSTICK frequency set to 8000000 Hz (scale set to 125).
STM32_RCC: Cortex SYSTICK ext ref frequency set to 1000000 Hz (scale set to 1000).
CLKTREE: PCLK1 Output Change (SrcClk:HCLK InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: PCLK2 Output Change (SrcClk:HCLK InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=2002ef80 R01=40011000 R02=40011000 R03=00000000
R04=2002ef80 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00008000 R13=2002ef58 R14=000005fb R15=000005fa
PSR=20000173 --C- T svc32
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=2002ef80 R01=00000000 R02=00000000 R03=40011000
R04=2002ef80 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00008000 R13=2002ef38 R14=00000611 R15=000003ac
PSR=60000173 -ZC- T svc32
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=00000000 R01=00000000 R02=1000002c R03=40011000
R04=2002ef80 R05=1000002c R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00008000 R13=2002ef38 R14=00000611 R15=000003ac
PSR=20000173 --C- T svc32
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=00000000 R01=00000000 R02=00000000 R03=40011000
R04=2002ef80 R05=1000002c R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00008000 R13=2002ef38 R14=00000611 R15=000003ac
PSR=80000173 N--- T svc32
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=17d78400 R01=00000000 R02=40011000 R03=0000008b
R04=2002ef80 R05=00000019 R06=00000000 R07=00000080
R08=00000064 R09=00000364 R10=00000000 R11=00000000
R12=00008000 R13=2002ef38 R14=00000551 R15=00000480
PSR=00000173 ---- T svc32
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=17d78400 R01=00000000 R02=00000000 R03=40011000
R04=2002ef80 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00008000 R13=2002ef58 R14=00000551 R15=00000610
PSR=00000173 ---- T svc32
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=17d78400 R01=00000000 R02=00000000 R03=40011000
R04=2002ef80 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00008000 R13=2002ef58 R14=00000551 R15=00000610
PSR=00000173 ---- T svc32
qemu stm32: hardware warning: Warning: You are attempting to use the GPIOC peripheral while its clock is disabled.

R00=17d78400 R01=00000000 R02=0000202c R03=40011000
R04=2002ef80 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00008000 R13=2002ef58 R14=00000551 R15=00000610
PSR=00000173 ---- T svc32

sys_open retrun value didn't follow UNIX spec

Currently if you use opendir to open a not exist path, e.g.:

dir = opendir('/tmp/not/exists');

dir will be -1.

But according to man opendir, it says:

RETURN VALUE
       The opendir() and fdopendir() functions return a pointer  to  the  directory  stream. 
       On  error,  NULL  is returned, and errno is set appropriately.

It should return NULL, not -1.

/proc didn't have process fd

Current /proc didn't generate process fd, e.g.

$ ls /proc
     3 .                     
     1 ..                    
  1001 version               
  1002 meminfo               

It should have thread_main and thread_idle, thread_softirqd's process fd directory.

Feature: Mutex with Priority Inheritance Protocol

In current patch, we already implemented a futex-liked mutex. It didn't support PI. In order to achieve better real-time capability, the higher priority task should execute as soon as possible. It also makes sense on synchronization. So we could apply PI to enhance our real-time capability.

By the way, this's feature would be released soon. Furthermore, folks should not work on this feature directly, because we already have a preliminary idea and some progress on it.

[1] LK Documentation - rt-mutex.txt Linux Kernel Documentation
[2] LK Documentation - rt-mutex-design.txt Linux Kernel Documentation
[3] LK Documentation - PI-futex.txt
[3] ChibiOS - RT Mutexes and Condition Variables
[4] Nuttx - Signaling Semaphores and Priority Inheritance
[5] x15.git

"ls -l" raises usage fault

hello, pikoRT developer:

Thank you for create this wonder land.

the following is how to generate the fault which i meet.

after OS boot sequence complete, the prompt will be displayed.
type the below 'ls' operation, will cause system hang up.

step 1. type 'ls'
step 2. type 'ls -l'
step 3. type 'ls'

the system will show the message like below:

#UsageFault

r0: 00000000 r1: 00003e73 r2: 00000002 r3: 00000014
r4: 00000008 r5: 200011f8 r6: 00000000 r7: 00003e73
r8: 00000002 r9: 00003688 r10: 20000f9c r11: 00000000
r12: 0000002d sp: 20028f90 lr: 000034a5 pc: 00002d82

EXC_RETURN: fffffff1
ufsr: 00000002 <INVSTATE>
-------------------------------------------------------------

-------------------------------------------------------------
#HardFault

r0: 00000000 r1: 00003e73 r2: 00000002 r3: 00000014
r4: 00000008 r5: 200011f8 r6: 00000000 r7: 00003e73
r8: 00000002 r9: 00003688 r10: 20000f9c r11: 00000000
r12: 0000002d sp: 20028f90 lr: 000034a5 pc: 00002d82

EXC_RETURN: fffffff1

for trying to understand the 'ls' command's flow, i try to add come code in the
below code piece.

    if (argc == 1)
        dir = opendir("/");  // FIXME: get current directory
    else {
        dir = opendir(argv[1]);
        printk("argv[1]=>%s, open %s\n", argv[1], (dir==NULL) ? "no dir":" done");
    }

    do {
        readdir_r(dir, &dirent, &result);
        if (result != NULL)
            printk("% 6d %s\n", dirent.d_ino, dirent.d_name);
    } while (result != NULL);
    closedir(dir);

the question is after step 3., the system will hang on. what is the root cause of this problem?
how to fix this problem?

Thank you very much.

BR,
Akio

Inconsistent behavior on scheduling selection

sched_select() explicitly work as a scheduler initialization routine. It does the following tasks 1) select scheduler policy 2) initialize relative scheduler structure for specified policy. However, we expect a function to initialize the scheduler with specified policy within start_kernel() not just select specified policy(realized mean from the function name).

CC @jserv , @mlouielu .

Thumb2 optimized string routines for performance and/or size

Piko/RT depends on several string routines such as memcpy and memset. They can be optimized in Thumb2 assembly in consideration of performance and/or size.

Sample implementation for memcpy:

static inline void memcpy(void *restrict dst, const void *restrict src, size_t l)
{
    __asm__ volatile(" \
        mov r1, %2; \
        mov r3, %1; \
        mov r4, %0; \
        orr r2, r3, r4; \
        ands r2, #3; \
        bne 2f; \
1: \
    cmp r1, #4; \
    ittt hs; \
    ldrhs r2, [r3], #4; \
    strhs r2, [r4], #4; \
    subshs r1, #4; \
    bhs 1b; \
2: \
    cmp r1, #0; \
    ittt ne; \
    ldrbne r2, [r3], #1; \
    strbne r2, [r4], #1; \
    subsne r1, #1; \
    bne 2b"
    :
    : "r" (dst), "r" (src), "r" (l)
    : "r1", "r2", "r3", "r4", "memory", "cc");
}

Sample implementation for memcpy:

static inline void memset(void *dst, int v, size_t l)
{
    __asm__ volatile(" \
        mov r1, %2; \
        mov r3, %1; \
        orr r3, r3, r3, lsl #8; \
        orr r3, r3, r3, lsl #16; \
        mov r4, %0; \
        ands r2, r4, #3; \
        bne 2f; \
1: \
        cmp r1, #4; \
        itt hs; \
        strhs r3, [r4], #4; \
        subshs r1, #4; \
        bhs 1b; \
2: \
        cmp r1, #0; \
        itt ne; \
        strbne r3, [r4], #1; \
        subsne r1, #1; \
        bne 2b"
    :
    : "r" (dst), "r" (v & 0xff), "r" (l)
    : "r1", "r2", "r3", "r4", "memory", "cc");
}

Feature: TTY abstraction layer

Hi folks,

This a feature I'm working on. In the current implementation, we use printk without buffering. That would cause a poor performance and a huge section with interrupt disable. However, that's one of the reasons we want to import TTY abstraction layer. TTY layer could provide not only performance improvement but also better abstraction for the various device, such as UART, BLE, USB ... . It's also an good target to measure softirq we impl.

By the way, this's feature would be released soon. Furthermore, folks should not work on this feature directly, because we already have a preliminary idea and some progress on it.

sys_msleep unusable

sys_msleep(100);
Piko version 0.0.0 (grd@louie) (armv7-m, cortex-m4) #Tue Aug 15 10:48:37 2017       
arm-none-eabi-gcc (Arch Repository) 7.1.0 

$                    
kernel panic: Overflow in kernel stack    
  0  ee48a608  00000000                   
  1  840dc3bc  00000000                   

-------------------------------------------------------------                       
 #UsageFault         

 r0: 2000f000    r1: 00000421    r2: 00000000    r3: 000001f1                       
 r4: 2000f000    r5: 00000421    r6: 00000000    r7: 000001f1                       
 r8: 00000201    r9: 00000211   r10: 2000f000   r11: 00000421                       
r12: 00000201    sp: 00000000    lr: 00000211    pc: 00000221                       

EXC_RETURN: fffffff1 
      ufsr: 00000000 
-------------------------------------------------------------                       

Github removed support for the Subversion protocol

According to
https://github.blog/changelog/2024-01-08-subversion-has-been-sunset/ ,
Github has no longer support subversion protocol from 2024/01/08,
the following bash commands in cmsis.mk don't work now.

$(CMSIS)/arm:
	svn export -r$(SVN_REV) -q --force https://github.com/ARMmbed/mbed-os/trunk/cmsis/ $(CMSIS)/arm

$(CMSIS)/TARGET_STM:
	svn export -r$(SVN_REV) -q --force https://github.com/ARMmbed/mbed-os/trunk/targets/TARGET_STM/ $(CMSIS)/TARGET_STM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.