Code on boot

Hello people! Alright?
I have a question. I had to enter a code at boot that handles some IOs, even before loading Linux on beagle. How could he do this? I have to enter the code in u-boot and compile it?

I use Angstrom.

Thank you!

I don’t believe it is possible to handle an IOs events using u-boot. u-boot runs using a limited memory resource.

Are you sure that is really necessary?

You will have to make changes in to the early startup Assembly Code. This modification can be done in the kernel code but i really believe that it is not necessary.

I based my arguments in the book Embedded Primer Linux, Chapter 5.

Best Regards,

Leví

You can read/write GPIO pins using the u-boot 'gpio' command within
the interpreter:
http://git.denx.de/?p=u-boot.git;a=blob;f=common/cmd_gpio.c;h=47eee89221fff34bb704a5fc5b6269f72234da19;hb=HEAD

This is how BeagleBoard and BeagleBoard-xM handle the USER button:
http://git.denx.de/?p=u-boot.git;a=blob;f=include/configs/omap3_beagle.h;h=d0daa455e5243ccbf616c4352a12e414319fe2ca;hb=HEAD#l284

/* "run userbutton" will return 1 (false) if pressed and 0 (true) if not */
userbutton=if gpio input 173; then run userbutton_xm; else run
userbutton_nonxm; fi;
userbutton_xm=gpio input 4;
userbutton_nonxm=gpio input 7;

289 #define CONFIG_BOOTCOMMAND \
290 "mmc dev ${mmcdev}; if mmc rescan; then " \
291 "if run userbutton; then " \
292 "setenv bootenv uEnv.txt;" \
293 "else " \
294 "setenv bootenv user.txt;" \
295 "fi;" \
296 "echo SD/MMC found on device ${mmcdev};" \
297 "if run loadbootenv; then " \
298 "echo Loaded environment from ${bootenv};" \
299 "run importbootenv;" \
300 "fi;" \
301 "if test -n $uenvcmd; then " \
302 "echo Running uenvcmd ...;" \
303 "run uenvcmd;" \
304 "fi;" \
305 "if run loaduimage; then " \
306 "run mmcboot;" \
307 "fi;" \
308 "fi;" \
309 "run nandboot;" \