如何在Raspberry Pi上没有操作系统的情况下运行C程序? [英] How to run a C program with no OS on the Raspberry Pi?

查看:100
本文介绍了如何在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程序

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.)

推荐答案

虽然Pi上可以使用裸机,但我会避免使用它,因为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.

如果您仍然想学习裸机知识,这里有一个入门指南:

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天全站免登陆