Skip to content

docs: add readme for samples#37

Open
sohshri796-cell wants to merge 1 commit into
vedantmalkar:mainfrom
sohshri796-cell:docs/samples-readme
Open

docs: add readme for samples#37
sohshri796-cell wants to merge 1 commit into
vedantmalkar:mainfrom
sohshri796-cell:docs/samples-readme

Conversation

@sohshri796-cell

Copy link
Copy Markdown

Adds a README.md file to the samples directory to inform users about how to simulate the samples and, explains the modifications needed to be done for emulation in QEMU. system_init() must be commented during emulation in QEMU as it cannot emulate the hardware initialisation that only needs to be done for actual hardware.

Closes #35

@mt-tass

mt-tass commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

I dont think changing the Makefile everytime for a different sample is a good idea
ideally we should have a different target for samples, something like
make sample PATH=samples/blink/blink.c
so that without editing the makefile we can build desired sample

Comment thread samples/README.md Outdated
then,
```make flash```

But to simulate in qemu, u need to modify the code a little bit,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
But to simulate in qemu, u need to modify the code a little bit,
But to simulate in qemu, you need to modify the code a little bit,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you should remove a little bit part also

@mt-tass

mt-tass commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

I dont think changing the Makefile everytime for a different sample is a good idea ideally we should have a different target for samples, something like make sample PATH=samples/blink/blink.c so that without editing the makefile we can build desired sample

@vedantmalkar @Paarth-Shirsat

@vedantmalkar vedantmalkar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say rewrite the README with these changes and more professional wording overall

also add commands to run the samples in qemu in a section

Comment thread samples/README.md Outdated
@@ -0,0 +1,31 @@
# Samples

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Samples
# Samples

remove space

Comment thread samples/README.md Outdated
@@ -0,0 +1,31 @@
# Samples

This directory contains sample applications demonstrating the features of this AstraRTOS.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This directory contains sample applications demonstrating the features of this AstraRTOS.
This directory contains sample applications demonstrating the features of AstraRTOS.

wording

Comment thread samples/README.md Outdated

To run a specific sample, open the `Makefile` in this directory and update it to point to your chosen sample instead of the default `main.c`.

For example:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example:
For example to run the mutex sample:

give real example

Comment thread samples/README.md Outdated
For example:
```makefile
# In your Makefile, swap the source file:
C_SOURCES = samples/your_chosen_sample.c ..... #and the rest of the files

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
C_SOURCES = samples/your_chosen_sample.c ..... #and the rest of the files
C_SOURCES = samples/mutex_basic/main.c ...

Comment thread samples/README.md Outdated
Comment on lines +17 to +20
For running them on hardware use:
``` make ```
then,
```make flash```

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove then, and keep both make and make flash under same set of backticks, commands under eachother

Comment thread samples/README.md Outdated
then,
```make flash```

But to simulate in qemu, u need to modify the code a little bit,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
But to simulate in qemu, u need to modify the code a little bit,
But to simulate in qemu, you need to modify the code a little bit,

Comment thread samples/README.md Outdated
Comment on lines +29 to +30
system_init() performs hardware initialization (such as clock configuration) that is something thats done on a real STM32 hardware.
QEMU does not fully emulate the hardware, so the initialization code may wait indefinitely for hardware-ready flags that never become set. Commenting out this call allows the program to continue running under QEMU.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be written better and more in depth

@vedantmalkar

Copy link
Copy Markdown
Owner

I dont think changing the Makefile everytime for a different sample is a good idea ideally we should have a different target for samples, something like make sample PATH=samples/blink/blink.c so that without editing the makefile we can build desired sample

yeah this seems like a good idea, worth implementing

Comment thread samples/README.md Outdated

---

To run a specific sample, open the `Makefile` in this directory and update it to point to your chosen sample instead of the default `main.c`.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To run a specific sample, open the `Makefile` in this directory and update it to point to your chosen sample instead of the default `main.c`.
To run a specific sample, replace the entry point in the top level `Makefile` from `app/main.c` to the sample you want

wording

@vedantmalkar

Copy link
Copy Markdown
Owner

@sohshri796-cell commit structure looks great, address the reviews and word the readme better

Comment thread samples/README.md Outdated
Comment on lines +30 to +31
system_init() is responsible for configuring critical low-level subsystems, primarily the Reset and Clock Control (RCC) unit. This involves enabling internal/external oscillators (HSI/HSE), configuring the Phase-Locked Loops (PLL), and switching the system clock source.
Because QEMU focuses on CPU instruction emulation rather than register-accurate peripheral simulation, it does not fully simulate the RCC state transitions. Consequently, these hardware-ready flags are never set within the emulator, causing the program to trap itself in an infinite loop before the RTOS kernel or scheduler can boot. No newline at end of file

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
system_init() is responsible for configuring critical low-level subsystems, primarily the Reset and Clock Control (RCC) unit. This involves enabling internal/external oscillators (HSI/HSE), configuring the Phase-Locked Loops (PLL), and switching the system clock source.
Because QEMU focuses on CPU instruction emulation rather than register-accurate peripheral simulation, it does not fully simulate the RCC state transitions. Consequently, these hardware-ready flags are never set within the emulator, causing the program to trap itself in an infinite loop before the RTOS kernel or scheduler can boot.
`system_init()` is responsible for configuring critical low-level subsystems, primarily the Reset and Clock Control (RCC) unit. This involves enabling internal/external oscillators (HSI/HSE), configuring the Phase-Locked Loops (PLL), and switching the system clock source.
Because QEMU focuses on CPU instruction emulation rather than register-accurate peripheral simulation, it does not fully simulate the RCC state transitions. Consequently, these hardware-ready flags are never set within the emulator, causing the program to trap itself in an infinite loop before the RTOS kernel or scheduler can boot.

@vedantmalkar

Copy link
Copy Markdown
Owner

add a section telling for the make qemu command

Comment thread samples/README.md Outdated
@mt-tass

mt-tass commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

dont add a new commit, we always group the changes for a single file or feature into one commit

…how to simulate the samples and, explains the modifications needed to be done for emulation in QEMU. system_init() must be commented during emulation in QEMU as it cannot emulate the hardware initialisation that only needs to be done for actual hardware.

Closes vedantmalkar#35

Signed-off-by: Sohshri <sohshri796@gmail.com>
@mt-tass

mt-tass commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

also your commit doesnt have a title ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add README.md to samples noting system_init() should be disabled in qemu

3 participants