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

error: values of the type [u8; 32768] are too big for the current architecture #7

Open
cr1901 opened this issue Feb 16, 2023 · 4 comments

Comments

@cr1901
Copy link

cr1901 commented Feb 16, 2023

I have a set of crates for embedding metadata about the current build into a microcontroller. I use this crate as a dep to parse semver info at compile time.

My crates should work on 16-bit archs like MSP430 and AVR. Unfortunately, 32768 bytes for a panic message is a little too large :P:

PS C:\msys64\home\William\Projects\rust-embedded\postcard-infomem> cargo +nightly build -p postcard-infomem-examples --target=msp430-none-elf --features=msp430g2553 -Zbuild-std=core
   ...
   Compiling const_panic v0.2.7
   Compiling konst v0.3.4
   ...
error: values of the type `[u8; 32768]` are too big for the current architecture

error: could not compile `const_panic` due to previous error

Is it possible to decrease the initial size down to 32-64 bytes (minimum amount of MSP430 RAM is 128 bytes) for 16-bit archs?

@cr1901
Copy link
Author

cr1901 commented Feb 17, 2023

Bad news: I cannot seem to actually duplicate this error at all, even with the commit where I initially saw it. So I can't provide a minimized example (I'm sorry!). That being said, I don't know the conditions where that max panic string size will appear in the final binary (even in debug mode).

Perhaps the size still should be lowered for those archs so code where a panic string needs to be created won't exceed the address space?

@rodrimati1992
Copy link
Owner

I have created the 16bit_arch_fix branch, which builds the msp430 target successfully, but I don't know if it would run successfully.

@cr1901
Copy link
Author

cr1901 commented Feb 17, 2023

I don't know if it would run successfully.

FWIW, the largest MSP430 I have has 8-10kB of RAM (10kB if USB buffers aren't used). So I can't test a 16kB buffer (even if I could duplicate the error, which I can't anymore). But hey, it compiles now :P.

The smallest MSP430s I have have 128 bytes of RAM. That's why I recommended such a low number. Surprisingly enough, I've deployed Rust firmware just fine on those (.text size is a bigger problem than .data/.bss size).

By contrast, the smallest ARM microcontroller I've personally seen has 1kB of RAM (LPC810, which they sadly discontinued :(...).

@trandersen-ufst
Copy link

I get this error when trying to build the standard library for an AVR on Ubuntu 22.04.

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

No branches or pull requests

3 participants