Problems with Custom Boot in MPC8260

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems with Custom Boot in MPC8260

1,018 Views
victor_manuel
Contributor I

Hi,

 

I'm new on programming for powerpc. I'm trying to make an application that sends a string to the serial port (SMC_2). The card that I'm using is an embedded powerquicc mpc8260. It has a Custom Boot that depending of two switches set the Counter Program to 0xf3000100. Then my program has to start at this position. I took the functions from the boot code. Here is my program:

 typedef struct buffer_descriptor{U16  cntl_stat     ;                 /*!< control & status register size = 2  offset  0*/U16  data_len      ;                 /*!< data length register    size = 2  offset  2*/U32  buf_address   ;                 /*!< buffer address register size = 4  offset 4*/}bd_t; typedef struct smc_buffers{                                                                                         /*smc1    smc2*/bd_t  rxbd          ;            /*!< receive buffer desciptor  size = 8    3F00    3f40*/U8  name        [8] ;            /*!< name of channel(user)     size = 8    3F08    3f48*/U8 rxbuffer    [16];             /*!< receive buffer            size = 16   3F10    3f50*/bd_t  txbd          ;            /*!< transmit buffer desciptor size = 8    3F20    3f60*/U32  condition     ;             /*!< condition register(user)  size = 4    3F28    3f68*/S32   last_result   ;            /*!< last result register(user)size = 4    3F2C    3F6C*/U8   txbuffer  [16];             /*!< transmit buffer           size = 16   3F30    3F70*/}smc_buffers_t;     //other structs
//other structstypedef struct proj_space{scc_buffers_t scc_buf[4]          ;              /*!< scc buffers and descriptors size = 256  0x300*/CS_t          device;U8            TBD[0x3560]         ;              /*!< for project use size = 14336  0x400*/U8            FCC1[0x100]         ;              /*Stuart*/U8            FCC2[0x100]         ;              /*Stuart*/U8            I2C[0x100]          ;              /*Stuart*/irq_action_t   *user_vectors[64]   ;              /*!< interrupt vectors size = 256    0x000*/low_vector    *except_vectors[32] ;              /*!< exception vectors size = 128    0x100*/U32           Registers_Store[37] ;              /*!< register store      size = 148    0x180*/U8            spare[0xEC]         ;smc_block_t   smc_blk             ;              /*!< smc block       size = 256  */}proj_space_t;
//other structstypedef struct dp_ram{/*proj_space_t  project; */proj_space_t    project ;U8              stuart      [  16384 ]    ;/*!< */param_ram_t     params                  ;/*!< dpram parameter blocks*//*S8              res2         [   8192 ]    ;/ *!< Reserved*/log_t      error;U8              dpram3       [   4096 ]    ;/*!< */S8              res3         [  16384 ]    ;/*!< Reserved*/sysconf_t       siu_conf                   ;/*!<  SIU Configuration*/memctl_t        memctl                     ;/*!<  Memory Controller*/sit_t           sit                        ;/*!<  System Integration Timers*/line_buf_t      line                       ;/*!<  PCI used by project*/intctl_t        intctl                     ;/*!<  Interrupt Controller*/car_t           clkrst                     ;/*!<  Clocks and reset*/iop_t           ioport                     ;/*!<  IO Port control/status*/cpmtim_t        cpmtimer                   ;/*!<  CPM timers*/sdma_t          sdma                       ;/*!<  SDMA control/status*/fcc_t           fcc          [      3 ]    ;/*!<  Three FCCs*/S8              res4         [    167 ]    ;/*!<  changed from original was 159*/S8              res4a        [    489 ]    ;/*!<  changed from original was 496*/U32             brgc5                      ;/*!<  Baud rate 5*/U32             brgc6                      ;/*!<  Baud rate 6*/U32             brgc7                      ;/*!<  Baud rate 7*/U32             brgc8                      ;/*!<  Baud rate 8*/S8              res5         [    608 ]    ;/*!< Reserved*/i2c_t           i2c                        ;/*!<  I2C control/status*/cpm_t           cpm                        ;/*!<  Communication processor*/U32             brgc1                      ;/*!<  Baud rate 1*/U32             brgc2                      ;/*!<  Baud rate 2*/U32             brgc3                      ;/*!<  Baud rate 3*/U32             brgc4                      ;/*!<  Baud rate 4*/scc_t           scc          [      4 ]    ;/*!<  Four SCCs*/smc_t           smc          [      2 ]    ;/*!<  Couple of SMCs*/spi_t           spi                        ;/*!<  A SPI*/cpmux_t         cpmux                      ;/*!<  CPM clock route mux*/}               dp_ram_t;static volatile dp_ram_t * const DP_RAM = (dp_ram_t *) DPRAM_ADRS;void sio_tx_str( nat8 channel, CONCHP p );bool hal_sio_tx_ready( U8 channel );dp_ram_t * hal_get_dp_ram_ptr( void );void watchdog_service ( void );ErrStr hal_watchdog_service( void );void hal_sio_tx_byte( U8 channel, Byte b );typedef enum smc_channels_e {SMC_1 = 0, SMC_2 = 1, SMC_ERROR = SMC_2} smc_channels_e ;void _start (void){sio_tx_str( SMC_2, "HELLO WORLD" );}void sio_tx_str( nat8 channel, CONCHP p ){    if (p) {        while (*p) {          while (! hal_sio_tx_ready( channel )) {               watchdog_service();           }            hal_sio_tx_byte( channel, *p++ );        }    }}bool hal_sio_tx_ready( U8 channel ){    bool status = true;    dp_ram_t * dp = hal_get_dp_ram_ptr();    hal_watchdog_service();    if ( dp->project.smc_blk.smc_buf_blk[channel].txbd.cntl_stat & BD_BUSY )    {        status = false;    }    return status;}dp_ram_t * hal_get_dp_ram_ptr( void ){    return (dp_ram_t *)DP_RAM;}void watchdog_service ( void ){   hal_watchdog_service();}ErrStr hal_watchdog_service( void ){    /* as specified in ICD */    __asm__ ("eieio");    WATCH_DOG_ADRS[ 0 ] = 0x0F;    __asm__ ("eieio");    WATCH_DOG_ADRS[ 1 ] = 0xF0;    __asm__ ("eieio");    WATCH_DOG_ADRS[ 2 ] = 0x81;    __asm__ ("eieio");    return 0;}void hal_sio_tx_byte( U8 channel, Byte b ){    volatile smc_buffers_t * buf;    buf = ( smc_buffers_t * ) & DP_RAM->project.smc_blk.smc_buf_blk[channel];    buf->txbuffer[0] = b;    buf->txbd.data_len = 1;    buf->txbd.buf_address = ( U32 ) & buf->txbuffer;    buf->txbd.cntl_stat = 0xA000;}

 And for compiling it I'm using cygwin with a cross-compiler:

 

powerpc-elf-gcc -Wall -g -c -Wno-pointer-sign -Wno-return-type -fomit-frame-pointer -fno-strict-aliasing  -ffreestanding -o prueba.o pruebse.c

 

powerpc-elf-ld -T ld.script -o pruebse.x pruebse.o

 

In the ld.script I have:

PROVIDE (__stack = 0); PROVIDE (___stack = 0);
PROVIDE (__executable_start = 0x100); . = 0x100;

 

powerpc-750-linux-gnu-objcopy -I elf32-powerpc -O srec --srec-forceS3 --srec-len=32 --set-start 0x0 --adjust-vma 0xf3000000 pruebse.x pruebse.mot

 

And the program doesn't send anything.

 

Could anyone help me please?

 

Sorry for my English.

 

0 Kudos
0 Replies