Cypress DCT-1D Guide de l'utilisateur Page 17

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 82
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 16
1.4. SOFTWARE
17
Command Explanation
d <addr> display memory content
m <addr> <data> modify memory content
g <addr> go (execute)
l load Intel hex file
u boot uClinux (copy from FLASH)
Table 1.2: Some useful commands in the monitor.
A simple program.
In this section we will demonstrate how to compile, load and run a C-program in the
monitor evironment. We will use the program described in Listing 1.1 as an example.
Listing 1.1: simpleprog
# i n c l u d e " common .h"
i n t main ( v oi d )
{
i n t Begin_Time , User_Time ;
i n t i ;
p r i n t f ( "Helloworld !\n" ) ;
Begin_Time = g e t _ t i m e r ( 0 ) ;
f o r ( i = 0; i <1 0 ; i ++) {
l e d ( i ) ; / S e t t h e l e d d i s p l a y on t h e c a r d /
p r i n t f ( "%d\n" , i ) ;
s l e e p ( 1 ) ; / s l e e p 1 s /
}
User_Time = g e t _ t i m e r ( Begin_Time ) ;
p r i n t f ( "Time=%ds\n" , User_Time ) ;
re t u r n ( 0 ) ;
}
The program prints a string, counts on the LEDs and measures the elapsed time.
To build simpleprog we use a Makefile described in Listing 1.2, in the Makefile
we observe the following:
A cross-compiler, or32-uclinux-gcc, must be used.
The functions printf, get_timer, led and sleep are library functions in
openrisclib, which is included in the lab skeleton for lab 1.
A link script ram.ld is used to determine where in memory our program should
be located.
Vue de la page 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 ... 81 82

Commentaires sur ces manuels

Pas de commentaire