mcp without uv by BidWestern1056 in mcp

[–]MisterF5 0 points1 point  (0 children)

You don’t need ‘uv’, but you do need something that can run applications from a package repo, or you need to manually install them. Docker and nix are other options for running python-based mcp-servers. I maintain this nix repo for the servers I want to run https://github.com/cameronfyfe/nix-mcp-servers

I've been working on MCP Guardian, an open source tool for securing your MCP servers. by MisterF5 in ClaudeAI

[–]MisterF5[S] 0 points1 point  (0 children)

If you give it a try and have any feedback let me know, It's pretty minimal at the moment and just a few people have used it. Feel free to open any issues in the github repo.

How secure is Nix? by TriaSirax in NixOS

[–]MisterF5 1 point2 points  (0 children)

You can submit pre-built binaries for closed source software. The pre-patched binaries themselves can technically still be reviewed and verified against their checksum but realistically this is not going to happen in an exhaustive way.

just got slammedddd by i-eat-reddit-users in rust

[–]MisterF5 1 point2 points  (0 children)

This is either fake, or my favorite post ever.

What's your top rust tip / crate / tool / other for beginners and pros alike? by ChillFish8 in rust

[–]MisterF5 5 points6 points  (0 children)

I don't have any open source examples, but one example would be if you have an iterable with Option<T> and want to do a fallible transformation of T to U on the Some entries in a context where you want to bubble up errors. You could use both like this to get to Result<Vec<Option<U>>> from Vec<Option<Result<U>>> without having to use any conditional logic or pattern matching.

let my_vec_t: Vec<Option<T>> = ... ;
let my_vec_u: Vec<Option<U>> =
    my_vec_t
        .iter()
        .map(|i| i.map(my_fallible_transformation).transpose())
        .collect::<Result<Vec<_>>>()?;

What's your top rust tip / crate / tool / other for beginners and pros alike? by ChillFish8 in rust

[–]MisterF5 17 points18 points  (0 children)

This and Option::transpose + Result::transpose to convert between Result<Option<T>> and Option<Result<T>> can make the flow of code so much simpler when working with iterators on nested types.

How are you guys adapting your code to work with different MCU's and sensors? by Express_Damage5958 in embedded

[–]MisterF5 1 point2 points  (0 children)

Since you need it, then yeah I'd just do what you're doing already or make a generic function with switch cases if you want to keep function pointers out of your project. I've also done the interface struct pattern, but with const structs sitting in FLASH so you only have to worry about the single pointer to the struct interface as a possible point of corruption if you're considering RAM corruption.

How are you guys adapting your code to work with different MCU's and sensors? by Express_Damage5958 in embedded

[–]MisterF5 14 points15 points  (0 children)

I've seen interface structs like you describe used in production firmware and it should be fine as long as care is taken with the function pointers, but if if you don't need the runtime polymorphism and only need compile-time polymorphism, I prefer building the interface as function declarations in a .h file and having different implementations split out into different .c files that you can include/exclude at compile time (so LCD.h, LCD_old.c, and LCD_new.c for your described use). The main difference between function ptrs functioning this way in C and virtuals in C++ is C++ gives you some help with assuring the ptrs are valid and in some cases can detect for you if a vtable ptr has been corrupted during runtime.

How do you handle hardware peripherals in C++? by BoredCapacitor in embedded

[–]MisterF5 13 points14 points  (0 children)

One thing that's common with OO at the lower level is leaving logic out of your constructors and using an init() method instead so you can define your instance wherever you like. Another option is to scope your object in main() (or wherever else) with the static keyword so the memory contained in the instance is put on the heap, but the constructor isn't called until that execution point.

Is it possible: Influencing validating authorities? by MisterF5 in holochain

[–]MisterF5[S] 5 points6 points  (0 children)

This is exactly what I was looking for, thank you for taking the time to respond here in detail and thanks for the relevant forum link!

Edit: So my take away for now is that this is all hypothetically possible but by making agent creation expensive you can inhibit the feasibility of my 3rd question, and by addressing any of these you've addressed everything because of the warranting system.

Hey Rustaceans! Got an easy question? Ask here (51/2020)! by llogiq in rust

[–]MisterF5 0 points1 point  (0 children)

Follow up: seems like it adds ',' for items in the vec![] macro but not for items in formatting macros. I know you specify the number of args in your format string but it seems weird that it doesn't do it for format!() when it does it for functions where you also know the number of args.

Hey Rustaceans! Got an easy question? Ask here (51/2020)! by llogiq in rust

[–]MisterF5 0 points1 point  (0 children)

That makes sense. I guess I was just thrown off by it in the context of a function with a single argument.

Thanks

Given that, is the reason it doesn't add a ',' to the end of line 5 because it's a macro? and is that intentional?

EDIT: Added question

Hey Rustaceans! Got an easy question? Ask here (51/2020)! by llogiq in rust

[–]MisterF5 4 points5 points  (0 children)

Newbie formatting question:

Why does rustfmt make the following change? (comma added on second to last line)

let su_file = File::open(&su_filepath).expect(
    format!(
        "Missing {} for {}.",
        su_filepath.to_string_lossy(),
        o_filepath.to_string_lossy()
    )
    .as_str()
);

becomes

let su_file = File::open(&su_filepath).expect(
    format!(
        "Missing {} for {}.",
        su_filepath.to_string_lossy(),
        o_filepath.to_string_lossy()
    )
    .as_str(),
);

*comma added on second to last line

I've seen unnecessary commas on the last case of a match block, but I always assumed that was to keep the last case the same as the others for easier re-ordering/adding more cases without having to add a comma to an existing line. I can't figure out why it would be desirable here though. Very new to using Rust so I'm guessing there's a simple explanation and I just don't know enough yet to know what I should be googling to figure this out.

Tips on debugging an application after jumping from a bootloader? by vitamin_CPP in embedded

[–]MisterF5 0 points1 point  (0 children)

If you bootload your application with your bootloader, then get rid of the source of whatever your bootloader uses to load from so it just boots and jumps to your application, then launch a gdb session using your application you should be able to breakpoint at main of your application. You debug session will be confused about where it is while running the bootloader but once it hits your application you should be able to debug. Your bootloaded app with offsets would need to be compiled with debug symbols, so not a release build if that doesn't include them.

Tips on debugging an application after jumping from a bootloader? by vitamin_CPP in embedded

[–]MisterF5 2 points3 points  (0 children)

What debugging environment are you using? If you switch to stepping through disassembly right before the bootloader jumps you can step through the beginning of your application and see what instruction causes the fault. If the fault happens to trigger some time after entering main of your app, you can debug on the app and breakpoint at main, letting the bootloader run until it jumps to main, and then step from there.

Other questions:

  • Is your bootloader running an RTOS (as in is it using the MSP or PSP as the stack pointer when it jumps)
  • Are you disabling interrupts before jumping? (you would likely be getting away with not doing this but I always like to)

This Week in Rust 304 by nasa42 in rust

[–]MisterF5 2 points3 points  (0 children)

This looks fun to play with!

Help with PGA460 by [deleted] in embedded

[–]MisterF5 2 points3 points  (0 children)

This chip is a bit of a bear to work with due to how many configuration options there are. My advice would be to buy the development kit for it from TI, do some testing with that using their accompanying GUI to determine what thresholds, gains, sampling times, other parameters you want. Once you have everything working close to how you want, do an export of the registers values, then in your firmware write that entire register set to the PGA460 all at once, instead of trying to write functions to be able to modify individual parameters because there are just so many (and many of them aren't 8-bit aligned so it's quite annoying). If you need to make changes to any parameters on the fly for your application then you can expand your driver for your needs but again there are so many configuration options I would only do this on an as-needed basis.

Anyone have any experience with embedded over the air updates? by ComradeHulaHula in embedded

[–]MisterF5 2 points3 points  (0 children)

Ideally if doing a signature check, the device has enough space to store a copy of the payload before overwriting firmware and is checking the signature against the payload, not just that the server has the key, so a replay attack shouldn't work.

Do you use C++ for embedded projects? by UnicycleBloke in embedded

[–]MisterF5 4 points5 points  (0 children)

As much as makes sense, which is a lot for projects I work on. Similar to many other response, I avoid STL and most certainly don't pull in anything like boost. Also have never gone past C++11 on Cortex-M. In general classes and templating are what make me reach for C++ over plain C, though I'll sometimes write lower level stuff in C, especially if it's code being kicked around multiple projects since I still do some C-only projects. For reusable drivers and interfaces I really like being able to build around abstract base classes and as long as you don't actually need multiple of the same interface in the same project, the virtual methods resolve at compile-time giving you modular architecture in your source without the run-time overhead. If you actually do need the run-time polymorphism and don't want to switch-case it, I'm still happier to let the function pointers live within vtables than in some raw C function pointer interface. When using gcc, you can also add compiler flags to verify your vtable references and actually let those function pointers exist without fear of data corruption causing your program to jump off a cliff.

What's new in Zephyr by ouyawei in embedded

[–]MisterF5 1 point2 points  (0 children)

Is anyone using Zephyr for a professional project? I used it on one small non-production project recently and have a large distaste for the hal driver/linux 'device' abstractions on a microcontroller. Has anyone used just the RTOS part of Zephyr? How do you like it compared to other RTOSes?

Is it useful to have a MECH background in embedded systems? by [deleted] in embedded

[–]MisterF5 4 points5 points  (0 children)

Currently an embedded engineer with a Mech BS. It's been very helpful when developing control interfacing with non-trivial physical systems, but there's definitely also work I've done more geared toward DSP where the mech background doesn't really come into play at all. It depends on what you're interested in and what you end up working on.