Difference between revisions of "Embedded/es"

From Free Pascal wiki
Jump to navigationJump to search
(New page: La finalidad embebida está todavía en desarrollo y solamente están soportados unos cuantos controladores. No obstante, es posible crear programas para dispositivos embebidos arm. Su fi...)
 
Line 1: Line 1:
 
 
La finalidad embebida está todavía en desarrollo y solamente están soportados unos cuantos controladores. No obstante, es posible crear programas para dispositivos embebidos arm. Su finalidad se centra en dispositivos que no utilizan sistema operativo y que tienen disponibles varios KBs de memoria RAM, más algunas docenas de KBs en memoria flash. A typical target is the LPC family of NXP con miembros populares tales como el PC2124 con 16 kB de RAM y 256 kB de flash utilizando el juego de instrucciones ARM7.
 
La finalidad embebida está todavía en desarrollo y solamente están soportados unos cuantos controladores. No obstante, es posible crear programas para dispositivos embebidos arm. Su finalidad se centra en dispositivos que no utilizan sistema operativo y que tienen disponibles varios KBs de memoria RAM, más algunas docenas de KBs en memoria flash. A typical target is the LPC family of NXP con miembros populares tales como el PC2124 con 16 kB de RAM y 256 kB de flash utilizando el juego de instrucciones ARM7.
  
 
= Embedded port =
 
= Embedded port =
  
== Status ==
+
== Estado ==
 +
 
 +
* solamente hay soporte útil disponible desde la versión 2.3.1 desde el svn.
 +
* actualmente solamente está soportado arm embebido.
 +
* los controladores soportados actualmente están limitados a los NXP LPC.
  
* useful support is only available in 2.3.1 from svn
+
== ARM Embebido ==
* currently only arm-embedded is supported
 
* supported controllers are limited to NXP LPC controllers
 
  
== ARM Embedded ==
+
=== Construcción ===
  
=== Build ===
+
Obtener los FPC más actualizados desde svn:
Get latest FPC from svn:
 
  
 
   svn co http://svn.freepascal.org/svn/fpc/trunk fpc
 
   svn co http://svn.freepascal.org/svn/fpc/trunk fpc
  
Get arm-embedded binutils.
+
Obtener las utilidades binarias embebidas arm.
  
For windows, they are available at http://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32. You can either checkout the whole directory with or download only arm-embedded-ar.exe, arm-embedded-as.exe, arm-embedded-ld.exe, arm-embedded-strip.exe, arm-embedded-objdump.exe and arm-embedded-objcopy.exe manually. Put these utils in a directory included in your path.
+
Para Windows, están disponibles en http://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32. You can either checkout the whole directory with or download only arm-embedded-ar.exe, arm-embedded-as.exe, arm-embedded-ld.exe, arm-embedded-strip.exe, arm-embedded-objdump.exe y arm-embedded-objcopy.exe manualmente. Sitúa estas utilidades en un directorio que esté incluido en la variable de entorno path.
  
Build FPC for arm-embedded:
+
Para construir FPC para arm embebido:
  
 
   cd fpc
 
   cd fpc
 
   make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm
 
   make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm
  
This builds only the compiler and the rtl instead of the whole FPC. Because of the limited capabilities of the embedded systems supposed to be used, building all packages is not usefull. However, one must be carefull to avoid overwriting an existing arm compiler on the system. If this is the case, INSTALL_PREFIX should be used to install into a different directory and switch between those.
+
Esto construye solamente el compilador y la rtl en lugar del FPC completo. Debido a las capacidades limitadas de los sistemas embebidos en los que utilizarlo, construir todos los paquetes no resulta demasiado útil. Como siempre, se debe tener cuidado para evitar sobreescribir un compilador arm pre-existente en el sistema. Si este es el caso, se debería utilizar INSTALL_PREFIX para instalarlo en un directorio diferente y commutar estre ellos.
  
=== Testing ===
+
=== Testeando ===
  
 
Below you find a simple example program, save it as tled1.pp to follow the description. The program is made for development boards like the LPC-WEB from OLIMEX (http://www.olimex.com/dev/lpc-e2124.html). When you press button 1, led 1 lights for a certain time, same for button 2 and led 2.
 
Below you find a simple example program, save it as tled1.pp to follow the description. The program is made for development boards like the LPC-WEB from OLIMEX (http://www.olimex.com/dev/lpc-e2124.html). When you press button 1, led 1 lights for a certain time, same for button 2 and led 2.

Revision as of 01:33, 27 June 2009

La finalidad embebida está todavía en desarrollo y solamente están soportados unos cuantos controladores. No obstante, es posible crear programas para dispositivos embebidos arm. Su finalidad se centra en dispositivos que no utilizan sistema operativo y que tienen disponibles varios KBs de memoria RAM, más algunas docenas de KBs en memoria flash. A typical target is the LPC family of NXP con miembros populares tales como el PC2124 con 16 kB de RAM y 256 kB de flash utilizando el juego de instrucciones ARM7.

Embedded port

Estado

  • solamente hay soporte útil disponible desde la versión 2.3.1 desde el svn.
  • actualmente solamente está soportado arm embebido.
  • los controladores soportados actualmente están limitados a los NXP LPC.

ARM Embebido

Construcción

Obtener los FPC más actualizados desde svn:

 svn co http://svn.freepascal.org/svn/fpc/trunk fpc

Obtener las utilidades binarias embebidas arm.

Para Windows, están disponibles en http://svn.freepascal.org/svn/fpcbuild/binaries/i386-win32. You can either checkout the whole directory with or download only arm-embedded-ar.exe, arm-embedded-as.exe, arm-embedded-ld.exe, arm-embedded-strip.exe, arm-embedded-objdump.exe y arm-embedded-objcopy.exe manualmente. Sitúa estas utilidades en un directorio que esté incluido en la variable de entorno path.

Para construir FPC para arm embebido:

 cd fpc
 make clean buildbase installbase CROSSINSTALL=1 OS_TARGET=embedded CPU_TARGET=arm

Esto construye solamente el compilador y la rtl en lugar del FPC completo. Debido a las capacidades limitadas de los sistemas embebidos en los que utilizarlo, construir todos los paquetes no resulta demasiado útil. Como siempre, se debe tener cuidado para evitar sobreescribir un compilador arm pre-existente en el sistema. Si este es el caso, se debería utilizar INSTALL_PREFIX para instalarlo en un directorio diferente y commutar estre ellos.

Testeando

Below you find a simple example program, save it as tled1.pp to follow the description. The program is made for development boards like the LPC-WEB from OLIMEX (http://www.olimex.com/dev/lpc-e2124.html). When you press button 1, led 1 lights for a certain time, same for button 2 and led 2.

<delphi> procedure Wait(d : dword); begin

 while d<>0 do
   dec(d);

end;


begin

 { initialize PLL }
 InitPLL(2,1);
 { initialize LEDs }
 { port 0.8: output }
 TBitvector32(GPIO0_IODIR)[8]:=1;
 { port 0.10: output }
 TBitvector32(GPIO0_IODIR)[10]:=1;
 { turn off both LEDs }
 TBitvector32(GPIO0_IOSET)[8]:=1;
 TBitvector32(GPIO0_IOSET)[10]:=1;
 { initialize button inputs }
 { port 0.9: input }
 TBitvector32(GPIO0_IODIR)[9]:=0;
 { port 0.15: input }
 TBitvector32(GPIO0_IODIR)[15]:=0;
 { endless loop}
 while true do
   begin
     { button 1 pressed }
     if TBitvector32(GPIO0_IOPIN)[15]=0 then
       begin
         { turn on LED, inverse logic }
         TBitvector32(GPIO0_IOCLR)[8]:=1;
         { wait }
         Wait(500000);
         {  turn off LED, inverse logic }
         TBitvector32(GPIO0_IOSET)[8]:=1;
     end;
     { button 2 pressed }
     if TBitvector32(GPIO0_IOPIN)[9]=0 then
       begin
         { turn on LED, inverse logic }
         TBitvector32(GPIO0_IOCLR)[10]:=1;
         { wait }
         Wait(500000);
         { turn off LED, inverse logic }
         TBitvector32(GPIO0_IOSET)[10]:=1;
     end;
   end;

end. </delphi>

If FPC for arm-embedded is installed as described above, the program can be compiled by

 fpc -Parm -Tembedded -Wplpc2124 tled1.pp
 -Parm

tells the compiler to compile for arm.

 -Tembedded

tells the compiler to compile for the embedded target.

 -Wplpc2124

tells the compiler to compile for the NXP LPC 2124. This has two effects: first, a unit (lpc21x4 in this case) containing the startup code and the port etc. definitions for this controller is loaded. Further, the compiler uses a linker script which fits the needs of this controller.

The result of the compiler is a .hex file which can be programmed by the NXP flash programming utility.

Adding new controllers

Useful links