Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    rahix
    @rahix:matrix.org
    [m]
    float support is pretty broken still, so it is probably just a miscompilation :/
    mjhouse
    @mjhouse:matrix.org
    [m]
    Speaking of which, I got f32/f64 working on the nano.
    instead of using fixed
    [profile.dev]
    ...
    lto = true
    overflow-checks = false
    ...
    turning off overflow checks lets you use them.
    rahix
    @rahix:matrix.org
    [m]
    interesting... but do they actually behave correctly? So far I've always encountered problems, where wrong results were produced
    mjhouse
    @mjhouse:matrix.org
    [m]
    Well, since I was having trouble printing the result to the serial output, I can't find out lol.
    As far as I could tell, yeah. But I didn't investigate too deeply.
    David
    @drmorr0:matrix.org
    [m]
    rahix: for the nano refactor, do you want it like it was before? (just as a feature of the arduino-uno board?) or do you want it as an entirely separate board in the boards/ directory?
    rahix
    @rahix:matrix.org
    [m]
    wait, you need to go to the next branch, it is all different now
    the boards folder is not used anymore at all
    1 reply
    there is an arduino-hal crate which has feature flags for each boards - you need to add arduino-nano there...
    and then we have examples/ with examples for each board. I am not sure if it makes sense to add separate examples for nano though, or if it is a better idea to just refer to the uno examples for them
    Take a look at Rahix/avr-hal#140 maybe as a rough guideline
    maybe I should just remove the legacy directories already to make it less confusing... sorry
    Carl Peto
    @carlos4242
    @rahix:matrix.org ... good call on the linker reverse trace
    @rahix:matrix.org ... good call on the linker reverse trace
    my problem fixed itself somehow... the link went back down from 38k (does not fit on atmega328p) to 8k (a bit fat but will fit)
    Also my link somehow got back down to 8k after some random rearranging. Swift is weird. They clearly aren't serious about keeping cruft out.
    I bookmarked it!
    I bookmarked it!
    David
    @drmorr0:matrix.org
    [m]
    thanks
    rahix
    @rahix:matrix.org
    [m]
    i'll get rid of it to make it less confusing!
    David
    @drmorr0:matrix.org
    [m]
    rahix: I guess I still have the same question just in a different form; the only (?) difference between the uno and the nano is the extra ADC pins, and it looks like that support is already there? at least it's present in the arduino-uno examples
    so do we really need to do anything for nano support? or is it basically just already done?
    David
    @drmorr0:matrix.org
    [m]
    I just flashed the uno-adc.rs example to my Nano and it appears to be working fine
    rahix
    @rahix:matrix.org
    [m]
    sorry for only responding now David :/ I took another look, you're right I must've copied that from the old arduino-uno crate with its nano support. I should have taken a closer look before sending you off with this! Now, I think the following would be a good plan:
    1. Add the arduino-nano feature flag to arduino-hal.
    2. Make the ADC6 and ADC7 pins only available for nano, not for uno. I think we should hide them so people don't accidentally use them on a board where it is not supported.
    3. Add an example crate for arduino-uno with just a blink and ADC example. I think for the rest we should just refer people to Arduino Uno, but it would be nice to a) have a blink example which you can just cargo run with zero setup, and b) show how the additional ADC pins can be used.
    What do you think?
    David
    @drmorr0:matrix.org
    [m]
    Yep, sounds good to me!
    Carl Peto
    @carlos4242
    I'm getting warnings that the atmega4809 is not a supported processor for llvm?
    Carls-MacBook-Pro:src carlpeto$ "/Applications/Swift For Arduino.app/Contents/XPCServices/S4ABuildEngine.xpc/Contents/Resources/llvm-avr/llc" -O3 -march=avr -mcpu=atmega4809 -filetype=obj -function-sections -o ../build/atmega4809/register_PORTE.DIR.swft.o ../build/atmega4809/register_PORTE.DIR.swft.ll
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    'atmega4809' is not a recognized processor for this target (ignoring processor)
    Carls-MacBook-Pro:src carlpeto$ "/Applications/Swift For Arduino.app/Contents/XPCServices/S4ABuildEngine.xpc/Contents/Resources/llvm-avr/llc" -O3 -march=avr -mcpu=atxmega3 -filetype=obj -function-sections -o ../build/atmega4809/register_PORTE.DIR.swft.o ../build/atmega4809/register_PORTE.DIR.swft.ll
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    'atxmega3' is not a recognized processor for this target (ignoring processor)
    rahix
    @rahix:matrix.org
    [m]
    you probably still need to set avrxmega3 IIRC
    Carl Peto
    @carlos4242
    my llvm is about 6 months old I think
    I did that with the second command? Is the format of my command wrong?
    ha... just re-read my command
    doh
    yep... that fixed it...
    Carls-MacBook-Pro:src carlpeto$ "/Applications/Swift For Arduino.app/Contents/XPCServices/S4ABuildEngine.xpc/Contents/Resources/llvm-avr/llc" -O3 -march=avr -mcpu=avrxmega3 -filetype=obj -function-sections -o ../build/atmega4809/register_PORTE.DIR.swft.o ../build/atmega4809/register_PORTE.DIR.swft.ll
    Carls-MacBook-Pro:src carlpeto$
    thanks so much @rahix:matrix.org
    :)
    glindstedt
    @glindstedt:matrix.org
    [m]

    Hello! 👋
    I just tried setting up a project for an attiny13, edited the target json file so cpu and mmcu = avr25, but getting this when I run cargo build -Z build-std=core:

       Compiling rustc-std-workspace-core v1.99.0 (/home/glindstedt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
    error: ran out of registers during register allocation

    Anyone else run into this?

    hm, got a different error when I ran with --release
    LLVM ERROR: Not supported instr: <MCInst 296 <MCOperand Reg:1> <MCOperand Imm:15> <MCOperand Reg:43>>
    glindstedt
    @glindstedt:matrix.org
    [m]

    :point_up: Edit: Hello! 👋
    I just tried setting up a project for an attiny13, edited the target json file so cpu and mmcu = attiny13, but getting this when I run cargo build -Z build-std=core:

       Compiling rustc-std-workspace-core v1.99.0 (/home/glindstedt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
    error: ran out of registers during register allocation

    Anyone else run into this?

    glindstedt
    @glindstedt:matrix.org
    [m]
    ok nevermind, debug build issue was fixed with optimizations added to profile.dev, and for the second issue I just found this which had a workaround at the end rust-lang/compiler-builtins#400
    Carl Peto
    @carlos4242
    This is a bit of a leading question but... does anyone know if llvm.global_ctors works properly in our AVR LLVM? I just started using clang to compile a .cpp file and the llvm back end isn't doing what I expect. It's creating an init_array section with pointers in there that seem to be twice what they should be (a standard AVR problem in various places we have had to fix).
    It looks like it's creating a relocation for that section that is of type R_AVR_16 but should be of type R_AVR_16_PM, no?
    (I reverted to compiling files that have initialisers with AVR-GCC instead for now.)
    ErikP0
    @ErikP0

    Hello,
    I'm having trouble doing floating point operations on my atmega328p (ardiuno nano). Casting f32 into ints, e.g. u8 is not
    working as expected:

    let dp = arduino_uno::Peripherals::take().unwrap();
    let mut pins = arduino_uno::Pins::new(dp.PORTB, dp.PORTC, dp.PORTD);
    let mut serial = arduino_uno::Serial::new(
            dp.USART0,
            pins.d0,
            pins.d1.into_output(&mut pins.ddr),
            57600.into_baudrate(),
        );
    
    let mut x: f32 = 11.45f32;
    loop {
        x += 0.1f32;
        let y: u8 = x as u8;
        ufmt::uwriteln!(serial, "cast is {}", y);
        arduino_uno::delay_ms(100);
    }

    The serial output is wrong

    cast is 0
    cast is 0
    ...

    I expected the compiler to generate a correct equivalent to
    a cast (byte)x in C. Replicating the same example in Ardiuno IDE in C, sends the expected values.

    Am I missing something here? I don't particularly care about speed or code size.
    Thanks

    rahix
    @rahix:matrix.org
    [m]
    This is a problem with the compiler, unfortunately. You can search the rust issue tracker, I don't have the link on hand right now