Posts
4830
Following
321
Followers
490
Linux kernel hacker and maintainer etc.

OpenPGP: 3AB05486C7752FE1

@liw I’ve tried this for out of memory conditions (aka memory exhaustion) in Rust but there’s no -ENOMEM :-) In unstable there is handle_alloc_error() but it is. sort of complicated track to adapt. Would be nice if you could do this every and each at the site, as callback indirection sucks…

In this thread I see one common and wrong conclusion:

“Yeah, but there are also other application areas, such as embedded environments with less RAM and no memory overcomittment.”

For restricted embedded payloads and stuff like that you usually define metrics already at the compile time, and use crates such as heapless. It is exactly dynamic over-committed memory where it would be nice to explicitly deal with this unexpected corner case.

It is pretty hard to sometimes discuss about memory issues in Rust with “rustaceans” because they are living in the myth of Rust being memory-safe. Nothing is never fully memory-safe.

1
1
0

@liw I’ve tried this for out of memory conditions (aka memory exhaustion) in Rust but there’s no -ENOMEM :-) In unstable there is handle_alloc_error() but it is. sort of complicated track to adapt. Would be nice if you could do this every and each at the site, as callback indirection sucks…

In this thread I see one common and wrong conclusion:

“Yeah, but there are also other application areas, such as embedded environments with less RAM and no memory overcomittment.”

For restricted embedded payloads and stuff like that you usually define metrics already at the compile time, and use crates such as heapless. It is exactly dynamic over-committed memory where it would be nice to explicitly deal with this unexpected corner case.

It is pretty hard to sometimes discuss about memory issues in Rust with “rustaceans” because they are living in the myth of Rust being memory-safe. Nothing is never fully memory-safe.

1
1
0

Kaljantaikevennys!

2
1
1

Jarkko Sakkinen

watched this embarrassingly many times https://www.youtube.com/watch?v=M8bt2SJnuX4
0
0
2

Jarkko Sakkinen

making new tracks over the weekend, here's one released last june https://nullzone2007.bandcamp.com/track/lumo-ava-2
1
0
0

Jarkko Sakkinen

Edited 1 year ago

@jmorris given that this is possible i would give it a shot in the similar situation. there’s lot of nostd stuff that you can probably easily adapt to this framework like my go-to rust library heapless.

i’ve taken practice even in non-embedded (user space) rust that i prefer nostd and heapless structures to the max over features when picking dependencies for a rust program. sort of addition of minimizing the number of unsafe regions is to minimize the number of heapful regions.

0
0
0
@jawnsy @jonmasters i'm in the process of selling my soul to riscv
0
0
0
I don't know how I ever came up with this but looks pretty useful to remember :-)
0
0
0

Jarkko Sakkinen

Edited 1 year ago
macro(import_binary_as_elf Path Symbol Target)
    set(objcopy_flags -I binary -O default -B riscv)
    string(MAKE_C_IDENTIFIER ${Path} unstripped)
    add_custom_command(
        OUTPUT ${Path}.elf
        DEPENDS ${Target}
        COMMAND 
             ${CMAKE_OBJCOPY} ${objcopy_flags}
             ${Path} ${Path}.elf
        COMMAND
              ${CMAKE_OBJCOPY} -N
              _binary_${unstripped}_end ${Path}.elf
        COMMAND
              ${CMAKE_OBJCOPY} --redefine-sym
              _binary_${unstripped}_start=${Symbol}_start
              ${Path}.elf
        COMMAND
              ${CMAKE_OBJCOPY} --redefine-sym
              _binary_${unstripped}_size=${Symbol}_size
              ${Path}.elf
    )
    add_custom_target(${Symbol}_elf DEPENDS ${Path}.elf)
endmacro()

#cmake #riscv #embed #binary #elf #note

1
0
0
@hasheddan The only thing I've read with thought is your "RISC-V Bytes" series. Salute and huge appreciation for writing those! Sound stuff.
1
1
1

I’d consider rewriting it with Rust and adr-hal.

1
0
1

quick jam during kid's naptime

3
2
1
Are you someone who has a simple fix for something in the Linux kernel, but haven't bothered submitting a patch because you find the email workflow daunting? Can be a bugfix, spelling correction, anything at all.

If so, I want to talk to you! I have tools that simplify this process quite a bit, but I need more feedback from people who aren't long-term Linux maintainers.

Please reach out, either via here or by emailing mricon@kernel.org.
9
425
333

Jarkko Sakkinen

Edited 1 year ago
My SATP and PTE issues might have been just ignorance. I've learned the ISA so far almost purely by trial and error. Should look at the spec but it is good to learn to swim first...
0
0
0
Show older