Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [threadx-dev] ThreadX and Rust - a demo
  • From: Jonathan Pallant <jonathan.pallant@xxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 12 Dec 2023 15:10:38 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ferrous-systems.com; dmarc=pass action=none header.from=ferrous-systems.com; dkim=pass header.d=ferrous-systems.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SbRyDgA5TI8baU2ecK8jH+TtalwdLeZr+6hnl/IuPbw=; b=MRhAuiaugNrIoLKN7qkLo+aIl/G0vlEnM3X7xm9fw4rf3g2mZ5RMq0NVs4GNyPHrM8aFYmwricSGZdLoQ68G8lat1cW+lfXddPhwkxyH1Q8VtDoT0gSuo8jMxBNav9fEozne82oykscXB5+YKc03nk2eaDEU/H8SMbB4MhpwPDToU2EmNZnzIBSNXYVlgGXRRBPP+aEfrOwhXQ/NSZ/PgAG5jg2uxocU3XbgUKi7n/bmLHfppmCTFJfqpf0dYtyRyAdSMwjMztL8XTjOJKEisXhlORcTmG1i1yTNVPdmRskQg0VcnAVstdkZ2Qnana4Sq775v3fwEZn25dZIC4NR+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nfUqYXL4MhsgISsAYRjiZ8Epm3o33zaDKeKgtS7t7I2ZjEJVhxhaIt0kf8XoWO+uH6uiGfFZVUo05a9462lyjZZi71MzMppTHrCr2CVX9jB8uRfNajoQsW4o+9VvgvOIbiltHsQj1UXGvI84rH8NDjsiRuQJqxgnkK6jXIm1iXsJIs4EuPs1jnsKRFTwegS9bhBbGIdGyHJicvPivOL/Ooa0NhvRKBkzAUMNGVQ6byyNfcIjMMiB+z3JOUd8SyfVogWV0fPk7J0NPyQHUqnO2z/vopnFXKcq1uQrxTzj/reYN+lcwyuugozfyOM1q90bqVFcYf4TtchS5CN74bS72w==
  • Delivered-to: threadx-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/threadx-dev/>
  • List-help: <mailto:threadx-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/threadx-dev>, <mailto:threadx-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/threadx-dev>, <mailto:threadx-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHaLQgzj+3rBhtV8UKuWkCYUwx/a7Clu5yAgAACjg0=
  • Thread-topic: [threadx-dev] ThreadX and Rust - a demo

Well the example I wrote (linked in the blog) is a no-std binary. So instead of being able to call std::thread::spawn you have to declare in Rust the relevant ThreadX C function prototype for creating a thread and then unsafely call it. Which is what std::thread would do for you, except it only knows how to do it on Windows, macOS, Linux and a few other OSes.

Of course many people write no-std binaries without using an RTOS, instead just dropping into a simple event loop and using interrupts. Or even just polling the hardware if power consumption isn’t an issue.

Jonathan


Sent from Outlook for iOS

From: threadx-dev <threadx-dev-bounces@xxxxxxxxxxx> on behalf of Frédéric Desbiens via threadx-dev <threadx-dev@xxxxxxxxxxx>
Sent: Tuesday, December 12, 2023 2:52:33 PM
To: threadx-dev@xxxxxxxxxxx <threadx-dev@xxxxxxxxxxx>
Cc: Frédéric Desbiens <frederic.desbiens@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [threadx-dev] ThreadX and Rust - a demo
 
Hi Jonathan. 

Thank you for sharing! I am no Rust expert, but I have some knowledge about it. Can you elaborate a bit about the pros of your approach compared to one leveraging no_std? I am just curious.

Best Regards,

Frédéric DESBIENS

Program Manager and Evangelist — Embedded, IoT, and Edge Computing | Eclipse Foundation

Mastodon: @fdesbiens@xxxxxxxxxxxxxxxxxxxxx

Eclipse Foundation: The Community for Open Innovation and Collaboration



On Tue, 12 Dec 2023 at 09:36, Jonathan Pallant via threadx-dev <threadx-dev@xxxxxxxxxxx> wrote:

As the developer of the open-source ISO 26262 qualified Rust toolchain, Ferrocene (https://ferrous-systems.com/ferrocene), we were excited to see that ThreadX will become an open-source safety-certified RTOS under the Eclipse Foundation. More functional safety tools and products should be open source!

 

Inspired by the announcement, I tried to run some Rust code to run on ThreadX, and then wrote a blog about the experience (https://ferrous-systems.com/blog/rust-and-threadx/). I used an nRF52840-DK and it worked out great!

 

In the future, if you are able to supply pre-compiled certified C static libraries (and the corresponding source code), I personally think there’s real scope for using that as part of a functional-safety application written in Rust. Very happy to talk more when the time is right.

 

Best wishes during your transition process,

 

Jonathan

 

-- 

Jonathan Pallant
Senior Embedded Systems Engineer
t. 01480 460933

m. +49 151 2845 8745

Ferrous Systems UK Limited

201a Victoria St.
LONDON
SW1E 5NE


_______________________________________________
threadx-dev mailing list
threadx-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://accounts.eclipse.org

Back to the top