profile
viewpoint
Sergey Matyukevich geomatsi St. Petersburg, Russia

geomatsi/ftdi-embedded-hal 24

Implementation of Rust Embedded HAL traits for FTDI devies

geomatsi/e.ziclean-cube 5

Experiments with custom firmware for e.ziclean cube robot vacuum cleaner

geomatsi/ducati-fw-tests 3

ducati fw experiments

geomatsi/e-notes 3

e-notes

geomatsi/drm_test 2

drm examples

geomatsi/cwiid 1

Linux Nintendo Wiimote interface

geomatsi/ftdi-rs 1

A Rust wrapper over libftdi1 library for FTDI devices

geomatsi/gst-drm 1

gst drm experiments

geomatsi/adsb 0

Library for representing ADS-B messages (no binary parsing though)

geomatsi/amp-mcu-tests 0

Experiments with AMP using remoteproc/rpmsg

issue commentrust-embedded-community/embedded-nal

Add type state to ensure proper usage

@eldruin That's an interesting problem. Maybe it's because I haven't done much network programming, but that doesn't seem like a super common use-case. However, I did manage to create a solution that doesn't require recursion, just a loop (which is exactly what I'd expect to accomplish this task).

It's ugly; I stopped working on it as soon as the compiler was happy :smiley:

fn bind_range<S: UdpStack<Error = UdpSocket>>(
    stack: &S,
    socket: UdpSocket,
    port: u16,
    port_max: u16,
) -> Result<UdpSocket, UdpSocket> {
    let mut p = port;
    let mut loop_socket = socket;
    loop {
        match stack.bind(loop_socket, p) {
            Ok(s) => return Ok(s),
            Err(s) => {
                loop_socket = s;
                if p == port_max {
                    return Err(loop_socket);
                }
            }
        }
        p += 1;
    }
}

Playground

To solve this in general though, I'd be in favor of changing the signature of socket-consuming fallible functions to return a tuple of (Socket, Self::Error).

   fn connect(&self, socket: Self::UdpSocket<Udp, Closed>, remote: SocketAddr) -> Result<Self::UdpSocket<Udp, Connected>, (Self::UdpSocket<Udp, Closed>, Self::Error)> where <Self as UdpStack>::UdpSocket<Udp, Connected>: core::marker::Sized;
Sympatron

comment created time in 5 hours

issue commentrust-embedded-community/embedded-nal

Add type state to ensure proper usage

@Sympatron I tried to use a trait, but it did not have the same effect. I couldn't get around needing to raise the generics up to the top-level of the Stack trait, which defeated the whole purpose. If you can figure out a way to apply it, I'd love to see a solution. I was unable to.

Sympatron

comment created time in 6 hours

pull request commentrust-embedded/cortex-m

Deprecate msp::write

I think we're good to merge this now. Could you add a changelog entry please?

jonas-schievink

comment created time in 6 hours

Pull request review commentrust-embedded/cortex-m

Deprecate msp::write

 pub fn read() -> u32 {  /// Writes `bits` to the CPU register #[inline]+#[deprecated = "calling this function invokes Undefined Behavior"]
#[deprecated = "calling this function invokes Undefined Behavior, consider asm::bootstrap as an alternative"]
jonas-schievink

comment created time in 6 hours

delete branch rust-embedded/cortex-m

delete branch : new-asm

delete time in 7 hours

PR merged rust-embedded/cortex-m

Expose __syscall and add new bootstrap method S-waiting-on-review T-cortex-m

We added __syscall in the new inline asm, but did not expose it in the crate API, and the cortex-m-semihosting crate can't use it directly because the pre-built binaries would contain duplicate symbols (#271). This PR renames it to __sh_syscall (since we could imagine other different syscalls; this one is explicitly semihosting with the bkpt 0xAB) and exposes it in cortex_m::asm::sh_syscall.

This PR also adds the new methods discussed in #297 to permit sound bootstrapping, either from an MSP and RV or a vector table address.

+74 -3

2 comments

18 changed files

adamgreig

pr closed time in 7 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 4a1c82fe37e05223951595648a74792cdc3c2179

Expose __syscall and add new bootstrap method

view details

Adam Greig

commit sha 3a3a812f53d9bb66f3fe042a514f813734eac4c6

Update pre-built binaries

view details

Adam Greig

commit sha 3b184eaa0abf147d607f918985bdffd6abe31a51

asm.bootstrap: only set CONTROL.SPSEL, mark as divergent

view details

Adam Greig

commit sha 155dd567d875fe8a911e694a3297988ce343fc70

Update src/asm.rs Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

Adam Greig

commit sha 64842461ba4caa384487ae52cbe15a4f3834b4b4

Update CHANGELOG.md Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

bors[bot]

commit sha 038396e6f944fb8697e2d4ecbd88cfca9d16b90e

Merge #299 299: Expose __syscall and add new bootstrap method r=jonas-schievink a=adamgreig We added `__syscall` in the new inline asm, but did not expose it in the crate API, and the cortex-m-semihosting crate can't use it directly because the pre-built binaries would contain duplicate symbols (#271). This PR renames it to `__sh_syscall` (since we could imagine other different syscalls; this one is explicitly semihosting with the `bkpt 0xAB`) and exposes it in `cortex_m::asm::sh_syscall`. This PR also adds the new methods discussed in #297 to permit sound bootstrapping, either from an MSP and RV or a vector table address. Co-authored-by: Adam Greig <adam@adamgreig.com>

view details

push time in 7 hours

delete branch rust-embedded/cortex-m

delete branch : staging.tmp

delete time in 7 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 4a1c82fe37e05223951595648a74792cdc3c2179

Expose __syscall and add new bootstrap method

view details

Adam Greig

commit sha 3a3a812f53d9bb66f3fe042a514f813734eac4c6

Update pre-built binaries

view details

Adam Greig

commit sha 3b184eaa0abf147d607f918985bdffd6abe31a51

asm.bootstrap: only set CONTROL.SPSEL, mark as divergent

view details

Adam Greig

commit sha 155dd567d875fe8a911e694a3297988ce343fc70

Update src/asm.rs Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

Adam Greig

commit sha 64842461ba4caa384487ae52cbe15a4f3834b4b4

Update CHANGELOG.md Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

bors[bot]

commit sha 038396e6f944fb8697e2d4ecbd88cfca9d16b90e

Merge #299 299: Expose __syscall and add new bootstrap method r=jonas-schievink a=adamgreig We added `__syscall` in the new inline asm, but did not expose it in the crate API, and the cortex-m-semihosting crate can't use it directly because the pre-built binaries would contain duplicate symbols (#271). This PR renames it to `__sh_syscall` (since we could imagine other different syscalls; this one is explicitly semihosting with the `bkpt 0xAB`) and exposes it in `cortex_m::asm::sh_syscall`. This PR also adds the new methods discussed in #297 to permit sound bootstrapping, either from an MSP and RV or a vector table address. Co-authored-by: Adam Greig <adam@adamgreig.com>

view details

push time in 7 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 4a1c82fe37e05223951595648a74792cdc3c2179

Expose __syscall and add new bootstrap method

view details

Adam Greig

commit sha 3a3a812f53d9bb66f3fe042a514f813734eac4c6

Update pre-built binaries

view details

Adam Greig

commit sha 3b184eaa0abf147d607f918985bdffd6abe31a51

asm.bootstrap: only set CONTROL.SPSEL, mark as divergent

view details

Adam Greig

commit sha 155dd567d875fe8a911e694a3297988ce343fc70

Update src/asm.rs Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

Adam Greig

commit sha 64842461ba4caa384487ae52cbe15a4f3834b4b4

Update CHANGELOG.md Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

bors[bot]

commit sha 0029295595e317007aa6d44e76f9c747d659a2a3

[ci skip][skip ci][skip netlify] -bors-staging-tmp-299

view details

push time in 7 hours

create barnchrust-embedded/cortex-m

branch : staging.tmp

created branch time in 7 hours

fork matklad/json

Strongly typed JSON library for Rust

fork in 7 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 64842461ba4caa384487ae52cbe15a4f3834b4b4

Update CHANGELOG.md Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

push time in 7 hours

Pull request review commentrust-embedded/cortex-m

Expose __syscall and add new bootstrap method

 and this project adheres to [Semantic Versioning](http://semver.org/).  ## [Unreleased] +### Added++- New assembly methods `asm::sh_syscall`, `asm::bootstrap`, and
- New assembly methods `asm::semihosting_syscall`, `asm::bootstrap`, and
adamgreig

comment created time in 7 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 155dd567d875fe8a911e694a3297988ce343fc70

Update src/asm.rs Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>

view details

push time in 7 hours

Pull request review commentrust-embedded/cortex-m

Expose __syscall and add new bootstrap method

 pub fn ttat(addr: *mut u32) -> u32 { pub unsafe fn bx_ns(addr: u32) {     call_asm!(__bxns(addr: u32)); }++/// Semihosting syscall.+///+/// This method is used by cortex-m-semihosting to provide semihosting syscalls.+#[inline]+pub unsafe fn sh_syscall(nr: u32, arg: u32) -> u32 {

Since this is public API, maybe a clearer name would be appropriate?

pub unsafe fn semihosting_syscall(nr: u32, arg: u32) -> u32 {
adamgreig

comment created time in 7 hours

delete branch rust-embedded/cortex-m

delete branch : update-sh-changelog

delete time in 8 hours

PR merged rust-embedded/cortex-m

Update c-m-sh changelog for 0.3.7 S-waiting-on-review T-cortex-m
+16 -0

2 comments

1 changed file

adamgreig

pr closed time in 8 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 64f936c64edf5ad127490cddac727dd39246edf2

Update c-m-sh changelog for 0.3.7

view details

bors[bot]

commit sha d34b1ce3eda92777ba9bafe2fca96e1985ec6d72

Merge #302 302: Update c-m-sh changelog for 0.3.7 r=jonas-schievink a=adamgreig Co-authored-by: Adam Greig <adam@adamgreig.com>

view details

push time in 8 hours

issue commentrust-embedded/cortex-m

Version 0.3.6 is not semver-compatible

Thanks @adamgreig for your very fast reaction!

samueltardieu

comment created time in 8 hours

delete branch rust-embedded/cortex-m

delete branch : staging.tmp

delete time in 8 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 64f936c64edf5ad127490cddac727dd39246edf2

Update c-m-sh changelog for 0.3.7

view details

bors[bot]

commit sha d34b1ce3eda92777ba9bafe2fca96e1985ec6d72

Merge #302 302: Update c-m-sh changelog for 0.3.7 r=jonas-schievink a=adamgreig Co-authored-by: Adam Greig <adam@adamgreig.com>

view details

push time in 8 hours

push eventrust-embedded/cortex-m

Adam Greig

commit sha 64f936c64edf5ad127490cddac727dd39246edf2

Update c-m-sh changelog for 0.3.7

view details

bors[bot]

commit sha f431a2b3f8188cb78a98d19d3b653d404a8a986e

[ci skip][skip ci][skip netlify] -bors-staging-tmp-302

view details

push time in 8 hours

create barnchrust-embedded/cortex-m

branch : staging.tmp

created branch time in 8 hours

issue closedrust-embedded/cortex-m

Version 0.3.6 is not semver-compatible

The prototype of hprintln!() has changed somewhere between 0.3.3 and 0.3.6, version should be bumped to "0.4.x".

I had the experience today. Some of my students had imported a few days ago a library skeleton containing a dependency over "0.3.3" or any compatible version, and the code uses hprintln!().unwrap(). Everything worked fine and it created a Cargo.lock depending on 0.3.3 for their application.

Some other students imported the same code today, and since they didn't have a Cargo.lock yet one got created with the highest compatible version, i.e. "0.3.6". Unfortunately, the code containing hprintln!().unwrap() now doesn't compile anymore.

closed time in 8 hours

samueltardieu

issue commentrust-embedded/cortex-m

Version 0.3.6 is not semver-compatible

This should be fixed by 0.3.7 which is now released. Sorry for the disruption!

samueltardieu

comment created time in 8 hours

pull request commentrust-embedded/cortex-m

Update c-m-sh changelog for 0.3.7

r? @thalesfragoso

(rust-highfive has picked a reviewer for you, use r? to override)

adamgreig

comment created time in 8 hours

more