Jens Schweikhardt created an issue:
https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5552
## Summary
A simple application with 10 tasks each printing "hello world" to the UART
crashes after a while (usually within 30 seconds).
The system used is risc-v 32 bit under QEMU. Everybody should be able to
reproduce this without hardware.
## Steps to reproduce
* Check out RTEMS 6.2
* Check out RSB for 6.2
* Build a toolchain for rtems6, riscv with the `config.ini` shown below
* Compile test application as shown below
* Run application under QEMU as shown below
This is the `config.ini` I used to build the toolchain:
```
[riscv/rv32imafc]
RTEMS_POSIX_API = True
BSP_CONSOLE_BAUD = 115200
RISCV_RAM_REGION_BEGIN = 0x80000000
RISCV_RAM_REGION_SIZE = 0x08000000 # 128MB
BSP_FDT_BL
RISCV_ENAB RISCV_RAM_REGION_SIZE
RISCV_BOOT 0x08000000
RTEMS_SMP
```
This is the `application.c` file:
```
#include <rtems.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef RTEMS_SMP
#error "RTEMS not compiled with RTEMS_SMP"
#endif
#define TASK_COUNT 10
rtems_id gTid[TASK_COUNT] = { 0 };
rtems_task user_application(rtems_task_argument aArgument);
rtems_task Init(rtems_task_argument ignored);
rtems_task Init(rtems_task_argument ignored) {
rtems_status_code status;
for (int t = 0; t < TASK_COUNT; ++t) {
/* *INDENT-OFF* */
status = rtems_task_create(
rtems_build_name('T', 's', 'k', 'A' + t),
1 + t,
RTEMS_MINIMUM_STACK_SIZE * 16,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT,
&gTid[t]);
/* *INDENT-ON* */
if (status != RTEMS_SUCCESSFUL) {
printf("rtems_task_create failed with status of %d.\n", status);
exit(1);
}
status = rtems_task_start(gTid[t], user_application, t);
if (status != RTEMS_SUCCESSFUL) {
printf("rtems_task_start failed with status of %d.\n", status);
exit(2);
}
}
status = rtems_task_delete(rtems_task_self()); /* should not return */
printf("rtems_task_delete returned with status of %d.\n", status);
exit(3);
}
rtems_task user_application(rtems_task_argument aArgument) {
for (;;) {
printf("hello, world from task %c\n", 'A' + (int) aArgument);
rtems_task_wake_after(100);
}
}
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'I', 'n', 'i', 't' )
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#define CONFIGURE_INIT_TASK_STACK_SIZE 65536
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
#define CONFIGURE_MAXIMUM_PROCESSORS 4
#define CONFIGURE_MAXIMUM_TASKS (1 + CONFIGURE_MAXIMUM_PROCESSORS + TASK_COUNT)
#define CONFIGURE_EXTRA_TASK_STACKS (CONFIGURE_MAXIMUM_TASKS *
RTEMS_MINIMUM_STACK_SIZE * 16)
#define CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS (5 * CONFIGURE_MAXIMUM_TASKS)
#include <rtems/confdefs.h>
```
To build:
```
riscv-rtems6-gcc -march=rv32imafc -mabi=ilp32f -qrtems \
-B /path/to/riscv-rtems6/rv32imafc/lib -o application.elf application.c
```
To run:
```
$ qemu-system-riscv32 -smp 4 -m 192M -nographic -M virt -bios none -kernel
application.elf
```
The crash looks like this, with garbled characters appearing after a while of
greeting, stopping output. Now the host CPU is busy looping. You can type
CTRL-A x to exit QEMU after the crash.
```
[several seconds of greetings here...]
hello, world from task E
hello, world from task F
hello, world from task G
hello, world from task H
hello, world from task I
hello, world from task J
hello, world from task A
hello, world from task B
hello, world from task C
hello, world from task D
hello, world from task E
hello, world from task F
hello, world from task G
hello, world from task I
d from ta����!��^�T�hello, world from task H
A��
����
```
Observations
* You must run qemu with "-smp N" and N>1. A single hart CPU with N=1 does not
crash.
* My host is FreeBSD 14.2-RELEASE
* My QEMU is 10.2.2
<!-- Pre-set options
- milestone
-->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5552
You're receiving this email because of your account on gitlab.rtems.org.
_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs