Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Compiling on Ubuntu 19.04 #14

Closed
mluds opened this issue Oct 11, 2019 · 4 comments
Closed

Compiling on Ubuntu 19.04 #14

mluds opened this issue Oct 11, 2019 · 4 comments

Comments

@mluds
Copy link

mluds commented Oct 11, 2019

Hello, I'm trying to compile this on Ubuntu 19.04:

I've installed the AVR tools/libraries:

sudo apt install binutils gcc-avr avr-libc avrdude

And have these versions of avr-g++ and make:

~/code/shruthi-1> /usr/bin/avr-g++ --version
avr-g++ (GCC) 5.4.0

~/code/shruthi-1> make --version
GNU Make 4.2.1

I also updated avrlib to use the correct path:

~/code/shruthi-1/avrlib> which avr-g++
/usr/bin/avr-g++

~/code/shruthi-1/avrlib> git diff
diff --git a/makefile.mk b/makefile.mk
index 3c1f5be..7a84990 100644
--- a/makefile.mk
+++ b/makefile.mk
@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-AVRLIB_TOOLS_PATH ?= /usr/local/CrossPack-AVR/bin/
+AVRLIB_TOOLS_PATH ?= /usr/bin/
 BUILD_ROOT     = build/
 BUILD_DIR      = $(BUILD_ROOT)$(TARGET)/
 PROGRAMMER     ?= avrispmkII

Then I run make and get this error:

~/code/shruthi-1> make
/usr/bin/avr-g++ -c -mmcu=atmega644p -I. -g -Os -w -Wall -DF_CPU=20000000 -D__PROG_TYPES_COMPAT__ -fdata-sections -ffunction-sections -fshort-enums -fno-move-loop-invariants -DDISABLE_DEFAULT_UART_RX_ISR  -DATMEGA644P -DSERIAL_RX_0 -mcall-prologues -fno-exceptions shruthi/part.cc -o build/shruthi1/part.o
shruthi/part.cc: In substitution of ‘template<class T> static void avrlib::ResourcesManager<ResourceId, Tables>::Load(const T*, uint8_t*, uint16_t) [with T = <missing>]’:
shruthi/part.cc:221:48:   required from here
shruthi/part.cc:221:48: internal compiler error: in type_hash_canon, at tree.c:6953
   ResourcesManager::Load(init_patch, 0, &patch_);
                                                ^

shruthi/part.cc:221:48: internal compiler error: Segmentation fault
avr-g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [avrlib/makefile.mk:95: build/shruthi1/part.o] Error 4

It seems to be an issue with patch_ being defined here: https://github.com/pichenettes/shruthi-1/blob/master/shruthi/part.h#L216

Any ideas what could be wrong?

@pichenettes
Copy link
Owner

This seems to be unrelated to the Shruthi code itself, but an error in the compiler itself.

Anyway, the Shruthi-1 codebase is so CPU and space constrained that it is only guaranteed to work with avr-gcc-4.3.3. Any other version will generate slightly different code that might not fit in the 64k of Flash memory available on the ATMega.

@mluds
Copy link
Author

mluds commented Oct 12, 2019

Thanks! For anyone wondering, I got it to compile (yet to test) by doing the following:

  1. Download Ubuntu 10.04: http://old-releases.ubuntu.com/releases/10.04.0/ and run in Virtualbox or VMware.
  2. Edit /etc/apt/sources.list and change all instances of us.archive with old-releases (to get package updates).
  3. sudo apt-get install git-core gcc-avr avrdude avr-libc
  4. Clone the source with --recursive for the submodules.
  5. Run make

This uses avr-g++ 4.3.4, so hopefully it gives the right output.

@vcavallo
Copy link

Thanks! For anyone wondering, I got it to compile (yet to test) by doing the following:

1. Download Ubuntu 10.04: http://old-releases.ubuntu.com/releases/10.04.0/ and run in Virtualbox or VMware.

2. Edit /etc/apt/sources.list and change all instances of `us.archive` with `old-releases` (to get package updates).

3. `sudo apt-get install git-core gcc-avr avrdude avr-libc`

4. Clone the source with `--recursive` for the submodules.

5. Run `make`

This uses avr-g++ 4.3.4, so hopefully it gives the right output.

Thanks for all the tips, @mluds ! After a lot of crazy nonsense I got this working on Ubuntu 10.
After makeing, the resulting firmware is 65396 bytes, which is above the recommended limit of 64512 :(

I wonder if it's because of using 4.3.4 rather than 4.3.3?

@pichenettes, is there anything a desperate maniac could manually trim out of the source files to cut the size down while keeping it functional? It seems like getting a working version of 4.3.3 running is super complicated but also the only viable way to flash this thing at this point. Any ideas?

@vcavallo
Copy link

Quick update: I've managed to downgrade to 4.3.3.
After running make clean and verifying that the build process re-ran properly, it still looks like the file is over the size limit:

image

(screenshot above shows the version of avr-g++, and this path is the one used in the makefile for the tools path)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants