termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

Package request: libc-avr and avr-gcc

Open ClockGen opened this issue 8 years ago • 10 comments

A toolchain for working with atmel microcontrollers, particularly compiling asm and C code. http://www.nongnu.org/avr-libc/ I haven't tried to build the packages myself yet, since compiling in termux is somewhat different from usual compiling and installing. Since there are already numerous android apps for flashing atmel microcontrollers, it might come in handy to be able to compile the firmware right on the android device.

ClockGen avatar Nov 21 '16 16:11 ClockGen

I like this.

Xhining avatar Apr 16 '17 02:04 Xhining

Try this , it works fine. https://github.com/opensource-apple/cctools https://cctools.info/index.php/Main_Page

Xhining avatar Apr 16 '17 02:04 Xhining

I tried that before, it works fine on jellybean devices, but broken for KitKat and newer android versions. Since lollipop, both internal and external memory are mounted with noexec flag, preventing cctools from running any binaries there. Also since lollipop android has a restriction to run binaries compiled without pie flag (and all of binaries in cctools are compiled without). Also, there are only binaries for armv7 (most of the new phones, including my own, running on 64 bit CPUs with arm64 architecture). In a few words, it doesn't work on new phones and new android versions.

ClockGen avatar Apr 19 '17 08:04 ClockGen

Has this situation changed any?

telepresencebot2 avatar Dec 17 '18 04:12 telepresencebot2

@telepresencebot2 we probably won't get avr-gcc working since the gcc toolchain isn't supported by the NDK anymore. We can however add the (still experimental last time I checked) avr target to our LLVM toolchain.

I was looking into that a couple of months ago, the toolchain built fine but I never tested it (was trying to compile for my arduino but had problems with the pre-processing of the source files). So, we can probably get a toolchain targetting avr but it needs to be tested. I can probably build llvm with the avr target if you are up for testing it

Grimler91 avatar Dec 17 '18 06:12 Grimler91

I'd be down to test it, but this is new territory for me, I've never built anything for android.

telepresencebot2 avatar Jan 20 '19 23:01 telepresencebot2

I've opened a PR to make it possible to target avr with clang: https://github.com/termux/termux-packages/pull/4552. Next step is probably to get arduino-cli working in termux, or atleast the upload part of it.

Grimler91 avatar Nov 17 '19 13:11 Grimler91

would be nice able to compile and get the .hex the rest is somewhat made

DMaisterra avatar Mar 28 '22 00:03 DMaisterra

Hi everybody. I tried to compile the simplest code for AVR and the result is only half positive. Compilation to an object file takes place, and for linking clang tries to call avr-ld, which we do not have. Therefore, the final result cannot be obtained.

Screenshot_20230107_164817

In this regard, it remains either to wait until the llvm is finished, or to wait for the package with avr-ld (part of AVR GCC).

borshec avatar Jan 07 '23 13:01 borshec

@borshec Use LLD: clang [...] -fuse-ld=lld [...]

xtkoba avatar Jan 09 '23 10:01 xtkoba

+1 requests

ahmad-wahyudin avatar Apr 14 '24 13:04 ahmad-wahyudin

The latest clang provided in termux packages can target AVR CPU architecture.

$ type clang
clang is /data/data/com.termux/files/usr/bin/clang

$ clang -print-targets | grep AVR
    avr         - Atmel AVR Microcontroller

This issue can be closed probably.

Biswa96 avatar Apr 14 '24 13:04 Biswa96