Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ayke
    @aykevl:matrix.org
    [m]
    Are you using function sections and data sections? Not using those could result in many functions that are included even though they aren't needed (because a different function in the same object file is needed).
    rahix
    @rahix:matrix.org
    [m]
    mjhouse: Can you give Rahix/avr-hal#165 a spin to see if that fixes Arduino Nano support?
    1 reply
    Carl Peto
    @carlos4242
    yeah, @aykevl:matrix.org ... I'm using function and data sections... I'll check over my makefile again, might be a glitch
    I tried avr-objdump -S to disassemble source and look for calls into the functions that I think should have been GCed.
    I also looked at the static library I'm linking in to check that those functions were in their own sections (they were... sections named .text.FUNCTION_NAME). So it's pretty weird.
    Kind of like to have some kind of "tree" where it showed me "this function is included because it's referenced by this relocation in function Y, which in turn is included because it's referenced by this relocation in function Z... and so on, back to some kind of root... like a reference from the main function or similar"
    rahix
    @rahix:matrix.org
    [m]
    Heh, I once built something like this using the radare2 scripting interface :D
    Ayke
    @aykevl:matrix.org
    [m]
    I've needed such a thing a few times
    rahix
    @rahix:matrix.org
    [m]
    It's super crude and hacky, but here: https://rahix.de/tmp/r2-symtrace.py (needs r2pipe from pypi)
    E.g. ./r2-symtrace.py @sym.malloc /path/to/firmware.elf to find all allocation calls :)
    It generates a graphviz dot file on stdout, so can be piped into | xdot - for example
    mjhouse
    @mjhouse:matrix.org
    [m]
    rahix: I used that new ravedude release, and it works for the nano now.
    Added a comment to the pull too, just for posterity.
    rahix
    @rahix:matrix.org
    [m]
    thanks :)
    mjhouse
    @mjhouse:matrix.org
    [m]
    no problem. Thanks for making it. I like the ravedude website too, btw.
    mjhouse
    @mjhouse:matrix.org
    [m]
    Hey rahix am I doing this right?
            let i2c = I2cMaster::new(
                dp.TWI,
                a4, 
                a5,
                57600
            );
    and my object temperature and ambient temperature are both 0.00, but there aren't any errors.
            let a4 = pins.a4.into_pull_up_input(&mut pins.ddr);
            let a5 = pins.a5.into_pull_up_input(&mut pins.ddr);
    rahix
    @rahix:matrix.org
    [m]
    looks good in general, though 57600 is a bit odd. For i2c, 50kHz or 100kHz are common (check what the peripheral supports)
    is the library using floating point nunbers?
    mjhouse
    @mjhouse:matrix.org
    [m]
    Yeah, hold on and I'll dump the whole thing.
        let a4 = pins.a4.into_pull_up_input(&mut pins.ddr);
        let a5 = pins.a5.into_pull_up_input(&mut pins.ddr);
    
        let i2c = I2cMaster::new(
            dp.TWI,
            a4, 
            a5,
            57600
        );
    
        let addr = SlaveAddr::default();
        let mut sensor = Mlx9061x::new_mlx90614(i2c, addr, 5).unwrap();
    
        loop {
            let temp = sensor.object1_temperature().unwrap();
            println!("Object temperature: {}ÂșC", temp);
            ...
        }
    temp is an f32
    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