Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory misalignment ARM Cortex-M33 #36990

Closed
mehrdadh opened this issue Jul 15, 2021 · 2 comments
Closed

Memory misalignment ARM Cortex-M33 #36990

mehrdadh opened this issue Jul 15, 2021 · 2 comments
Assignees
Labels
area: ARM ARM (32-bit) Architecture bug The issue is a bug, or the PR is fixing a bug

Comments

@mehrdadh
Copy link

Describe the bug
I have built a model with TVM on nRF5340DK using Zephyr RTOS and I ran into a memory misalignment. In TVM we define a large memory that we use as the TVM stack and we make sure the memory allocation always has alignment of 4 bytes.

static uint8_t g_aot_memory[WORKSPACE_SIZE];

However we ran into this bug where the initial address of the memory was misaligned and causes a CPU exception on FP32 operation. To fix this I added an attribute which fixed this problem, but my assumption was that zephyr would take care of this in the first place.

static uint8_t __attribute__((aligned(4))) g_aot_memory[WORKSPACE_SIZE];

TVM Issue: apache/tvm#8474

Environment (please complete the following information):

  • OS: Linux
  • Zephyr v2.5-branch at this commit: dabf237
  • Zephyr SDK: 0.12.3

I wasn't sure if this is a bug or I missed a CONFIG in my project file. So any help here is appreciated

@mehrdadh mehrdadh added the bug The issue is a bug, or the PR is fixing a bug label Jul 15, 2021
@carlescufi carlescufi added the area: ARM ARM (32-bit) Architecture label Jul 16, 2021
@cfriedt
Copy link
Member

cfriedt commented Jul 20, 2021

I would strongly suggest using our predefined stack declaration macro K_KERNEL_STACK_DEFINE but this does not seem to be a bug in Zephyr itself.

@cfriedt cfriedt closed this as completed Jul 20, 2021
@mehrdadh
Copy link
Author

This PR fixed this issue in TVM:
apache/tvm#8487

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM ARM (32-bit) Architecture bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

4 participants