在Raspberry Pi上运行无操作系统的C程序 [英] Running a C Program with No OS on Raspberry Pi

查看:187
本文介绍了在Raspberry Pi上运行无操作系统的C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试使用Raspberry Pi进行一些不同的低级嵌入式应用程序。唯一的问题是,与可用的AVR和PIC微控制器板不同,Raspberry Pi通常运行一个操作系统(如Raspbian),可以在所有运行的程序中分配CPU时间,并使某些实时应用程序变得不切实际。

I'd like to experiment using the Raspberry Pi for some different low level embedded applications. The only problem is that, unlike the AVR and PIC microcontroller boards available, Raspberry Pi typically runs an OS (like Raspbian) that distributes CPU time across all running programs and makes it impractical for certain real time applications.

我最近了解到,假设你有一个像GRUB一样的引导加载程序,在x86上运行一个C程序几乎没有实际的设置,只是一个程序集程序来调用主函数和实际的C代码。

I've recently learned that, assuming you have a bootloader like GRUB installed, running a C program on x86 (in the form of a kernel) takes very little actual setup, just an assembly program to call the main function and the actual C code.

有没有办法用Raspberry Pi实现这一点?
这将是学习低级ARM编程的好方法,它已经有一些复杂的外围设备(USB,以太网等)。

Is there a way to achieve this with a Raspberry Pi? It'd be a great way to learn about low level ARM programming, and it already has a few complex peripherals to mess around with (USB, Ethernet, etc.)

推荐答案

虽然裸机是可能的,我会避免它,因为Linux变得如此轻便,并为您处理一大堆东西。

While bare metal is possible on the Pi, I would avoid it since Linux is getting so lightweight and handles a whole bunch of stuff for you.

如果您想要继续学习裸机,这里是一个让您开始的教程: http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/

Here's a tutorial to get you started if you want to still learn bare metal stuff: http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/

所有这一切,我只是加载你最喜爱的嵌入式linux发行版(RT补丁可能会根据您的要求而优先),并称之为好。

With all that said, I would just load up your favorite embedded linux distro (RT patched might be preferred based on your requirements) and call it good.

这篇关于在Raspberry Pi上运行无操作系统的C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆