S5PC100 First Bare Board program LED

Source: Internet
Author: User
Tags volatile

Development environment:

System: Ubuntu 10.04.4

Veneer: s5pc100 (ces-c100)

Compiler: arm-linux-gcc-4.3.2

Build the development environment see Ubuntu 10.04.4 Development environment configuration.

Target: Achieve s5pc100 4 LEDs flashing on single board

The first program is simple and is implemented in a compilation. The hardware is as follows:

D2-->xeint12/cg_gpio3

D3-->xeint13/cg_gpio1

D5-->xeint14/cg_gpio2

D6-->xeint15/cg_gpio0

Write code according to the S5PC100 manual, including 3 file start. S, MAIN.C and makefile.

First, write the source code

File start. S

. Global

_start:
	/*1. Disable Watchdog */
	/*1. Close watchdog */
	LDR	r0, =0xea200000
	mov	r1, #0
	str	r1, [r0]

	b	Main

File main.c:

#define GPH1CON (* (volatile unsigned int *) 0XE0300C20)
#define GPH1DAT (* (volatile unsigned int *) 0XE0300C24)

void delay (void)

{
  volatile int i = 0x200000;
  while (i--);
}
void Led_init ()
{
  Gph1con = 0x11110000;

}
int main ()
{
  led_init ();
  while (1)
    {
      gph1dat = 0x0000;
      Delay ();
      Gph1dat = 0xFFFF;
      Delay ();

}
  return 0;
}

File Makefile:

1_led.bin:start. S main.c
	arm-linux-gcc-c start. S-o start.o
	arm-linux-gcc-c main.c-o main.o
	arm-linux-ld-ttext 0x27e00000 start.o main.o-o led_elf
	arm -linux-objcopy-o binary-s led_elf 1_led.bin
	arm-linux-objdump-d led_elf > Led.dis clean
:
	rm-rf *.O * . bin Led_elf *.dis

Second, compile

change@change:~$ CD si/s5pc100/1_led/
change@change:~/si/s5pc100/1_led$ ls
MAIN.C Makefile mktiny210spl.exe start. S
change@change:~/si/s5pc100/1_led$ make
Arm-linux-gcc-c start. S-o START.O
Arm-linux-gcc-c Main.c-o MAIN.O
Arm-linux-ld-ttext 0x27e00000 START.O Main.o-o led_elf
Arm-linux-ld:warning:cannot find entry symbol _start; Defaulting to 27e00000
Arm-linux-objcopy-o binary-s led_elf 1_led.bin
arm-linux-objdump-d led_elf > Led.dis
change@change:~/si/s5pc100/1_led$ ls
1_led.bin Led.dis led_elf main.c main.o Makefile mktiny210spl.exe start.o start. S
change@change:~/si/s5pc100/1_led$./mktiny210spl.exe 1_led.bin 1_leds.bin
-bash:./mktiny210spl.exe:permission denied

Modify Permissions to

change@change:~/si/s5pc100/1_led$ sudo chmod 777 Mktiny210spl.exe

change@change:~/si/s5pc100/1_led$./mktiny210spl.exe 1_led.bin 1_leds.bin
change@change:~/si/s5pc100/1_led$ ls
1_led.bin 1_leds.bin led.dis led_elf main.c main.o Makefile mktiny210spl.exe start.o start. S

Note: One of the Mktiny210spl.exe tools is to add a header to the code you write yourself. Since the s5pc100 is booted from the internal ROM to the user program, there is a validator legitimacy. This tool is popularly said to ensure the legitimacy of the user program. Here is a brief description, which will be described in detail later.

Third, burn write, test

The program is relatively simple, or put in memory to run it. Of course, write to the SD card, and then boot from the SD card can also be run. In the future will also write a program to operate the NAND self-updating, then download the program is convenient. The following is a self-updating program that can operate NAND, which is used to test the program and put it into memory to run

O
********************************
                   boot
                   2013.3.5
********************************
[W] Write The NAND flash [
R] read the NAND flash [
e] erase the NAND flash
[g] Get file, and write to NAND flash 0 block< C8/>[X] Get file to DDR (0x27e00000), run it
[b] Boot the Kernel
[l] load BL2 code to Sdram,and run BL2
[d] D Ownload BL2 code to NAND flash
[s] reset the programe
x use
 gtkterm to send file

Enter x, start waiting, use Gtkterm to start sending the above compiled generated 1_leds.bin, the LED on the S5PC100 board starts flashing.

Gtkterm installation configuration is described in the Ubuntu 10.04.4 development environment configuration.

Need tools and source code, leave the mailbox.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.