Skip to content

Native sim support#183

Merged
kr-t merged 7 commits intomainfrom
native_sim_support
Mar 3, 2026
Merged

Native sim support#183
kr-t merged 7 commits intomainfrom
native_sim_support

Conversation

@SorinOlari
Copy link
Collaborator

@SorinOlari SorinOlari commented Feb 27, 2026

Description

This PR includes the following changes:

  • added support for native_sim for mini, demo and supervisor samples
  • documentation has been updated to include native_sim

Also, this PR fixes the following bugs:

  • added a check for TARGET_ISA X86_64 in wamr.cmake to know if application is built for 32 or 64 bit architecture

  • in memory.c malloc() was replaced with alligned_alloc(), because WAMR expects linear memory to be aligned before allocation

  • fixed a bug in wamr.c with wrong parameter passed to user_malloc() function

  • Fixes issue # native_sim #175

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Tested mini, demo and supervisor for native_sim, native_sim/native/64 and b_u585i_iot02a

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@SorinOlari SorinOlari requested a review from casaroli February 27, 2026 14:14
@SorinOlari SorinOlari self-assigned this Feb 27, 2026
@SorinOlari SorinOlari added this to Ocre Feb 27, 2026
@SorinOlari SorinOlari linked an issue Feb 27, 2026 that may be closed by this pull request
Copy link
Contributor

@casaroli casaroli left a comment

Choose a reason for hiding this comment

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

gcc-multilib is only required if you are running ubuntu 64-bit and want to run native-sim 32-bit.

  • on 32-bit systems, there is no gcc-multilib packages

  • on 64-bit only systems like arm64, there is no gcc-multilib also.

So, even that we support that, to add it to the github workflows would require more work (in the Dockefile), so I belive it is better if we just document this board, but not test it.

dfu-util \
file \
gcc \
gcc-multilib \
Copy link
Contributor

Choose a reason for hiding this comment

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

this would break arm64 support as gcc-multilib is not available there.

Suggested change
gcc-multilib \

board:
- pico_plus2/rp2350b/m33
- native_sim/native/64
- native_sim
Copy link
Contributor

Choose a reason for hiding this comment

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

so we don't build in the CI as we will not have gcc-multilib

Suggested change
- native_sim

matrix:
board:
- native_sim/native/64
- native_sim
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- native_sim

Comment on lines +64 to +68
# 64-bit
west build -p always -b native_sim/native/64 src/samples/supervisor/zephyr/

# 32-bit
west build -p always -b native_sim src/samples/supervisor/zephyr/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# 64-bit
west build -p always -b native_sim/native/64 src/samples/supervisor/zephyr/
# 32-bit
west build -p always -b native_sim src/samples/supervisor/zephyr/
west build -p always -b native_sim/native/64 src/samples/supervisor/zephyr/

Copy link
Contributor

@casaroli casaroli Feb 27, 2026

Choose a reason for hiding this comment

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

"Alternatively, the native_sim board could be used for supported 32-bit platforms."

- **supervisor**

**Note:** native_sim on 32-bit is not currently supported.
**Note:** The 32-bit variant requires `gcc-multilib` to be installed on your host machine (see [Prerequisites](#prerequisites)).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Note:** The 32-bit variant requires `gcc-multilib` to be installed on your host machine (see [Prerequisites](#prerequisites)).
**Note:** The 32-bit variant requires `gcc-multilib` to be installed on your host machine (see [Prerequisites](#prerequisites)) if you are running a 64-bit system.


Start with [Getting Started with Zephyr](../../GetStartedZephyr.md) to get a working build environment.

To build for the 32-bit `native_sim` variant, install `gcc-multilib` on your host machine:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To build for the 32-bit `native_sim` variant, install `gcc-multilib` on your host machine:
To build for the 32-bit `native_sim` variant on a 64-bit system, install `gcc-multilib` on your host machine:

```bash
sudo apt install gcc-multilib
```

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Note: this is not required for 32-bit systems.

## Limitations

- **64-bit only**: 32-bit native_sim is not supported
- **32-bit requires gcc-multilib**: Install `gcc-multilib` on your machine before building the 32-bit variant
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- **32-bit requires gcc-multilib**: Install `gcc-multilib` on your machine before building the 32-bit variant
- **32-bit requires gcc-multilib on 64-byt systems**: Install `gcc-multilib` on your machine before building the 32-bit variant

@SorinOlari SorinOlari force-pushed the native_sim_support branch from 07e77c9 to 75b3b25 Compare March 1, 2026 21:57
@SorinOlari SorinOlari requested a review from casaroli March 2, 2026 08:18
Signed-off-by: SorinO <sorin.olari2@gmail.com>
…orrect ISA variant, 32 or 64 bit

Signed-off-by: SorinO <sorin.olari2@gmail.com>
@SorinOlari SorinOlari force-pushed the native_sim_support branch from 75b3b25 to 0e59c43 Compare March 3, 2026 08:42
…o malloc was replaced with alligned_alloc

Signed-off-by: SorinO <sorin.olari2@gmail.com>
…ation

Signed-off-by: SorinO <sorin.olari2@gmail.com>
…FIG_OCRE_SHARED_HEAP_BUF_VIRTUAL with CONFIG_OCRE_SHARED_HEAP_BUF_SIZE

Signed-off-by: SorinO <sorin.olari2@gmail.com>
Signed-off-by: SorinO <sorin.olari2@gmail.com>
@SorinOlari SorinOlari force-pushed the native_sim_support branch from 0e59c43 to c06da1f Compare March 3, 2026 08:59
Signed-off-by: SorinO <sorin.olari2@gmail.com>
@kr-t kr-t merged commit 2d33715 into main Mar 3, 2026
34 checks passed
@github-project-automation github-project-automation bot moved this to Done in Ocre Mar 3, 2026
@kr-t kr-t deleted the native_sim_support branch March 3, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

native_sim

3 participants