Difference between revisions of "2010 ICASSP Lab 1 Wiring and Running the Beagle"
(Created page with 'Category:ECE597 Category:BeagleBoard Here's what you need to do to get your Beagle running for the first time. * Write you Beagle as shown * Insert the SD card * Plug i…') |
m (Removed category) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
[[Category:BeagleBoard]] | [[Category:BeagleBoard]] | ||
+ | [[Category:Workshops]] | ||
Here's what you need to do to get your Beagle running for the first time. | Here's what you need to do to get your Beagle running for the first time. | ||
− | * | + | * Wire your Beagle as shown |
* Insert the SD card | * Insert the SD card | ||
* Plug in the 5V power | * Plug in the 5V power | ||
Line 18: | Line 18: | ||
ls /sys | ls /sys | ||
</pre> | </pre> | ||
− | <code | + | <code>/proc</code> and <code>/sys</code> are files that map to the hardware. |
* Try | * Try | ||
<pre> | <pre> | ||
Line 64: | Line 64: | ||
return 0; | return 0; | ||
} | } | ||
+ | </pre> | ||
+ | |||
Compile and run it | Compile and run it | ||
<pre> | <pre> |
Latest revision as of 06:31, 28 April 2011
Here's what you need to do to get your Beagle running for the first time.
- Wire your Beagle as shown
- Insert the SD card
- Plug in the 5V power
- Login and look around. Left-click on the background to get a menu.
- Try starting an XTerm.
- Try some basic Linux commands
ls, cd, less mplayer ls /proc ls /sys
/proc
and /sys
are files that map to the hardware.
- Try
cd /sys/class/leds ls cd beagleboard::usr0 ls cat trigger echo none > trigger echo 1 > brightness
cat trigger
tells you what options you can set trigger to. Try some of them. Explore /sys
and /proc
is see what else you can find.
Homework
There are many interesting programs already compiled for the Beagle that aren't on the SD card we gave you. New applications can be easily installed using the opkg
package manager. When you are back home and connected to the network try:
opkg list | less opkg install gcc
The first command lists the packages you can install. The second command installs the gcc C compiler. With a compiler installed you can take your favorite C program and compile and run it on the Beagle. Here is the embedded version of Hello World as presented in The Embedded Linux Primer.
#include <stdio.h> int bss_var; /* Uninitialized global variable */ int data_var = 1; /* Initialized global variable */ int main(int argc, char **argv) { void *stack_var; /* Local variable on the stack */ stack_var = (void *)main; /* Don't let the compiler */ /* optimize it out */ printf("Hello, World! Main is executing at %p\n", stack_var); printf("This address (%p) is in our stack frame\n", &stack_var); /* bss section contains uninitialized data */ printf("This address (%p) is in our bss section\n", &bss_var); /* data section contains initializated data */ printf("This address (%p) is in our data section\n", &data_var); return 0; }
Compile and run it
yoder@beagleboard:~$ gcc helloBeagle.c yoder@beagleboard:~$ ./a.out Hello, World! Main is executing at 0x8380 This address (0xbefa1cf4) is in our stack frame This address (0x10670) is in our bss section This address (0x10668) is in our data section
This is a program I use what talking about the address spaces on the Beagle and virtual memory.
Try some of your own C programs. See how well they run. If you come up with something interesting, add them to the wiki.