HN user

quake

219 karma
Posts0
Comments46
View on HN
No posts found.

I've also worked in this space for a few years and the amount of HN-style overconfident "we can fix this in hardware like the old days, the computers are coming for us!" comments without understanding the automotive industry or how cars are wired is pretty hilarious.

Something that should be noted for anyone who actually reads this is that the level of vulnerability is wildly different between automakers. No universal solution exists.

ASIL-critical inputs/outputs should not be encrypted,full end stop. Do I really trust that the dinky economy-scale micro that GM would pick is always going to hold up that encryption when I'm starting to drift off road? Absolutely the hell not.

I worked in this space (auto RE, including keyless entry) for a while, and there's almost no way this would work at scale without a top-down platform redo for automakers.

Your arguments are almost identical to the ones greybeard embedded devs have against the Arduino. Yeah, it's expensive, uses an outdated micro (at least the AVR-based Arduinos), but it's effective because of its popularity. Basically a flywheel effect. Doesn't have to be good or optimal, just has to be flexible and have a big community.

I doubt anyone is using an off the shelf Pi with SD card for an actual safety critical deployment and expect to get it certified. There are options like the Revolution Pi which is half PLC and uses the Pi's Broadcom SOC for non-safety calculations. Some even support CODESYS.

I agree that most ARM embedded Linux SOC's can be absolute dumpster fires when it comes to peripheral documentation and poorly maintained device trees (looking at you, Texas Instruments!!!) but that's nothing new in embedded dev. Learning how each manufacturer/platform do hardware peripherals is half the battle.

So I agree that the pi isn't always the best device for an application. Cost and power savings on an ESP32, better processing on your old laptop-turned-server, and so on. But the Pi does have excellent documentation, and was lucky enough to gain enough traction to create an ecosystem that reduces friction to just get something running for beginners, which is literally its original design intention.

Takes some knowledge of the std lib of whatever language you're using (easy with C and Rust, harder with C++) to know what calls will try to allocate memory. But another method is to use a static buffer of bytes designated in the link table as your "heap" and have tasks only allocate when they start, and ensure they do not free that memory. Algorithmically, allocation is the easy part, reusing freed blocks is more difficult. So if your embedded allocator doesn't free and faults at OOM, if you allocate only at the start of a program, you can still be more confident in memory safety

I can probably chime in here. I have used Rust professionally for 2 years but I've been working with it as a hobby for 3. Experience predominantly in C/C++ embedded and systems environments.

I've used Rust for *nix based IOT programs to ingest data from different sources (network I/O, serial, CAN, files, etc), as well as for bare-metal embedded development. I've also made some dinky webservers as an exercise and various random tooling.

It's a very, very flexible language, once you get over its quirks. I found myself using it to make tools that I would usually turn to Python for. I'm quite impressed with how "high level" the language feels despite being able to work with low-level concepts. Simple stuff like mapping iterators and the Option<T> type while working without an OS is a fantastic feeling.

As most people will likely say, take Rust for a test drive with a basic project to decide for yourself. I would say to keep it simple and not go down the async route as your first foray, though.

What the author fails to comment upon is the sheer breadth of embedded applications and focuses almost exclusively on IOT to prove a point about distributed systems (which he does quite well at a medium-high level). The analogy falls apart pretty quickly when you compare webdev to a safety critical system with hard real-time guarantees. Such a system may not have a viable logging framework due to deployment location or security reasons. From a 10,000 foot level I agree with the premise, but I think the title fails to explain the real topic: "similarities between embedded IoT and web development"

Not to mention the amount of similarities between SkyTrain and BART with the automated system and custom parts. It didn't even strike me as odd that the trains didn't have drivers until a dump of snow hit the rails and someone had to open the front compartment of the train to access the manual controls to drive it into Columbia Station (why is it always Columbia?)

Unsafe is exactly what they are in C. They're essentially volatile memory that can change at any time, and woe befall anyone messing around with the same register without synchronization when using an RTOS.

Good HAL crates don't have the entire register set as one struct, thank goodness. And for something like printing a message to serial in a panic handler, there are still unsafe options to yank control of registers, same as C.

What I really like about some of the HAL crates is the usage of builder patterns while configuring a peripheral. Setting up timer parameters before starting it by design is chef’s kiss wonderful.

But if you want to put the whole peripheral set in a static global, you can do that with a RefCell<Mutex<T>> or something similar. Or just yolo it and use unsafe blocks to ditch the mutex.

I've found Cargo more than up to the task of managing build configurations, and doesn't require monkeying around with CMake scripts or Makefiles. It was pointed out in another comment but you can gate features and crates based on the target you're compiling to. Cargo also supports custom build profiles so you can also pick and choose what you want even if it's all on the same target.

Creating a heap in Rust on a cortex M is safe and cheap-ish with a crate supported by the rust-lang developers. Much easier than implementing your own free() method on a memory pool.

I think you would like rtic. Not a pre-emptive rtos, but a way to manage context between ISR's without relying on some kind of module or global variable that can get corrupted by multiple accessors. Very minimal overhead compared to FreeRTOS

I've done some small embedded Rust applications on various STM32 and RP2040 boards. I've been doing embedded dev in C professionally for 7 years and Rust full-time for 2.5, mix or system and bare metal.

It's very hard to unlatch your brain from some of the common C/C++ embedded principles of static context variables and thinking of the hardware registers as "owned" memory, which you have to do in Rust. The auto-generated HAL crates aren't that great unless you're using the most common ones like stm32f4 or RP2040. Even then, it's hard to create a portable device driver without delving into generic-hell.

That all said, the ecosystem is moving fast, and a lot of my gripes above are just a product of the embedded rust ecosystem being very new in comparison to C. I do love rtic as a framework, and while I've given embassy a try I think it's trying to do too much aside from being a good async runtime, it should just focus on the runtime and not with stuff like creating its own entire HAL. Hubris and humility are fascinating but I just haven't gotten around to tinkering with them yet.

Lots of good tooling too, and the fact that most of your original C/C++ debugging tools are compatible with rust binaries is just the icing on the cake.

I know that there's the whole Ferrocene project, but until that produces results, stick with C if you're doing safety-critical applications, especially if they need to be certified

I picked up Sable on a lark (also because I saw the Moebius-inspired art style and immediately fell in love). It's a fine game that you can tell was a labour of love by only a handful of people, for better and for worse. It hit that same vein of open-ended exploration that Breath of The Wild has and the same feeling of constant discovery the latter game has in its early hours. I do wish that Sable was less utopic, with dangers in the wild dunes from creatures or weather hazards, but that wouldn't work with the art style and doesn't make sense with the narrative. It's a great game, even if you can get around the often-janky flight model of the hoverbikes and bugs like occasional clipping into the environment.

I don't have an addiction to games, but I play a lot of them because it's how I keep in touch with my friends from across the country. At the start of COVID/WFH, I was pretty concerned that I'd become a gaming addict. The reason I didn't is one of those smart/dumb oxymorons: I've just been plugging the peripherals from my gaming tower into my work laptop. After a day of work, the absolute last thing I want to do is sit at the same desk staring at the same screen and play games. Even on the weekends, I look at the desk and get this "ugh this feels like work" feeling which has really helped with not playing games in my spare time.

This of course has two huge caveats:

1. I didn't have a gaming addiction in the first place, evidenced by the fact that I have a Nintendo Switch that gets played in short bursts, rather than constantly.

2. I work with embedded systems/hardware, so I need to have an actual workstation area to keep the tools (debugger probes, power supply, oscilloscope, etc) on. The embedded systems curse of always needing more ports has been a pretty effective anchor for keeping my workspace in the same place as my PC, and if it wasn't, then I'd probably get more "I should spend all day today playing games" desires

I love this guide!

My first job out of university reqiured networking a small Linux device to an FPGA running a UDP stack, with nothing else. I'd never done anything with networking in C before, and this guide just made everything click

This makes a ton of sense to me. When I was a kid, just about everyone (including my parents) knew I had ADD/ADHD, but never did anything about it. Including myself. It wasn't until I lost a job because I was so easily distractable that I realized how much of a hold it had on my life. Medication helps, but really only on making it easier to pry myself from distractions.

But this study clarifies so much of my behaviour and self-image from when I was a kid to now. I bully myself fiercely, and never understood why I should be praised for high grades, when it was something expected of me. That definitely extends to now, where I can finish/deliver a product, but feel _nothing_ about it. No sense of accomplishment, no relief that something's shipped. Nothing. It stops me from taking on hobbies or really doing anything with the material that I learn. Leads to regular burnout and cycles of depression.

The article references methylphenidate as a good drug for ADHD, specifically for motivation. This makes me sad, because I'm on it, and not feeling very motivated.

Apart from the fact that Canada has closed its border with the US because of COVID, of course.

Pay on average is lower, but comes with a higher degree of social security and stability. Of course, Canada is not without its own racist past or present, but it's not quite as "on display" as the US. Our previous prime minister tried to have a "barbaric cultural practices" hotline which was essentially a dogwhistle to more Islamophobic elements of the Conservative party base.

That being said, I'm thankful that our police aren't tear gassing protesters in Ottawa so that Trudeau can have a photoshoot.

The tech industry in general isn't as large as the US, but does carry a lot of talent. Places to note are Kitchener-Waterloo, Toronto, Ottawa, Vancouver, Montreal and...maybe Calgary? I'm not so sure about the data science field myself, but I do know that most large tech firms around here do carry an analytics team.

Edit to add: like others have noted, COL is high in Toronto and Vancouver. That being said, I absolutely loved living in Vancouver and would move back there from Waterloo in a heartbeat. If you're able to land a job and afford living there (or more likely in another Lower Mainland city), I would recommend it.

A couple years ago I moved across Canada for work, and even after a couple years I still haven't met a ton of people here that aren't coworkers. And none of the people I met, I met over facebook. It was always through Meetup or Reddit. So long ago I uninstalled Facebook from my phone, and I have a localhost line to prevent my computer from going to the site. My phone has facebook messenger on it, and that's as far as I go, since that's how I stay in touch with most of my friends in BC. The messenger only option is fantastic, and taken even further by turning off those stupid floating chat bubbles. I can talk to them, but cannot see anything they post.

Do I feel like I missed anything about the people I care about? Yeah I kind of do, but mostly it's FOMO from seeing all my friends continue to do backpacking trips while I'm working in southern Ontario, so that's circumstantial. But on the whole? I couldn't care less. I had to turn off the localhost rule to sell some stuff on Marketplace, and I browsed my news feed for the first time in over a year, and it was a nightmare hellscape of stuff I just couldn't care less about. Better off with the filter.

About 5 years ago I bought probably the last watch I'd ever need. It's a solar powered Casio with timezones, and the normal 'digital watch' accoutrements. The little energy-saving details are fantastic. It has analog hands with a small digital screen. Why waste energy on backlighting when you can use glow in the dark paint that charges with the same light as the energy source? Too dark or too still? Turn off the screen until you move the watch. There was a time when it was in a drawer for a couple months while I was traveling, and when I got it out and put it in the sun, it fired right back up, and adjusted the time itself. I've seen it drop into a low charge maybe twice. It feels like it's meant to last forever, and I believe it's probably some of the best 50 bucks I've ever spent.

I've used a Fitbit and a couple friends have Apple watches, but the entire concept of charging an always connected timepiece just makes no sense to me.

A few years ago I bought an 'old' ('00 Integra) that had the stock head unit. It would only play CD ROM. It was a total pain to find actual CDs and not DVDs. I dug up mine and my girlfriend's old zip-up CD books full of ripped/torrented mix-cds from when we were teenagers, and it was an actual blast. It felt so good to rediscover some albums I hadn't thought of in the last 10-15 years. The Integra is getting a little long in the tooth, and I'm going to be sad that my time machine to 2005-2007 is going away.

Really depends on the vehicle. Some will have broadcast traffic that is easier to spoof, and ride on CAN addresses that aren't reserved for OBD. OBD quite often rides on the main CAN network, and without a gateway any ECU can be queried. The secondary CAN network (if the vehicle has one) is also on the OBD plug but on different pins.

RTOS are in everything! They make a ton of sense if you have a lot of resources to manage or calls to external services that may block for some time, like a modem connection. Lots of IOT products have RTOS's running under the hood, where running a kernel even as stripped back as Linux can be is too expensive computationally. And with less kernel/OS overhead, a true hard real time system can be implemented with a pretty strong guarantee of safety (not crypto safety, operational safety). There's a reason Amazon bought FreeRTOS a while back.

I started a job at a new company about 6 months ago after a stressful 20 months at my first real engineering job. I didn't know that I had one of these 'bad managers' until I had a good one. The difference between a manager that knows what they want, and know the product/environment over a manager that simply knows what they want in very broad strokes is staggering.

The attention-sucking and vapidity is independent of the media it's derived from. As long as it's 'pushed' information it doesn't matter if the information comes from a train radio or through the internet. I don't see much of a difference between the Denham's Dentriface section and the constant pinging of attention our phones (and others' phones) request from us.

We have access to nearly unlimited information, but even then, I don't think most internet users are using it to exchange great works of thought or even 'surfing' as the internet was intended to be used. Instead we have these massive FAANG silos that don't offer anything less vapid than the media described in the book. Even some of the more "idea-exchange" styled websites (Reddit, Twitter) are cesspools of low-effort thought, injokes, and memes.

We have too much information, and a worrying amount of it is untrue or misleading. But that's addressed by Faber in the novel as well, about the centrifuge throwing off all unnecessary thought. If there's so much media blasting in from all directions it gets hard to distinguish and the frequency of it all takes away the will to sift through fact from fiction. This is what leads to the 'fake news' aspect you mentioned. This is also addressed in the book. It's been a while since I've read it, but at one point Montag's wife stays glued to her televisor walls with Jesus himself on the screen telling her about how only his true followers buy some companie's product. Now, Montag's wife would surely have known that Jesus would not have been alive during the time of CorpCo's Wonderful Bottled Drink (or whatever it was called), but she doesn't think about it, she's too wrapped up in the overwhelming pressure applied by the media environment and believes it. It's the same when you surround yourself with this manufactured outrage stuff, and start buying into more and more outrageous 'fake news' claims because it justifies your anger, plays into your new opinions. It feels good, a positive feedback loop. It's the same.

I have so many fond memories of watching Alone in the Wilderness with my father and little brother. My mom would send us to bed, only for him to wake us up so we could watch it together late at night.