コード例 #1
0
_exit (int ret)
{
  /* Doing an "exit" system call would work on nSIM with hostlink, but call to
     _exit_halt, which will do a CPU halt is more universal and will work in
     many other cases as well, including an FPGA/SoC.  */
  _exit_halt ();
}
コード例 #2
0
ファイル: gm_debug1.c プロジェクト: mrtos/gk6105s-id
void _exit(int i)
{
    extern void _exit_halt();
    _exit_halt();
}
コード例 #3
0
ファイル: flashdump.c プロジェクト: mrtos/gk6105s-id
/*
*******************************************************************************
**
** \brief The main flashdump function
**
*******************************************************************************
*/
void main()
{
#if 0
    volatile U32* start_addr = (volatile U32*)(void*)&_start;
    U32* copy_array = (U32*)(void*)(*(start_addr-FLASHER_U32OFFSET_FLASH_IMAGE_DATA));
    U32 copy_count = *(start_addr-FLASHER_U32OFFSET_FLASH_IMAGE_SIZE);
    U32 flash_base = *(start_addr-FLASHER_U32OFFSET_FLASH_BASE_ADDRESS);
    U32 flash_offset = *(start_addr-FLASHER_U32OFFSET_FLASH_ADDRESS_OFFSET);
    U32 next_offset = *(start_addr-FLASHER_U32OFFSET_FLASH_ADDRESS_OFFSET);
    U32 verbose_flag = *(start_addr-FLASHER_U32OFFSET_VERBOSE_MODE);
    U32 gap_flag = *(start_addr-FLASHER_U32OFFSET_ADDRESS_GAP_FLAG);
    U32 word_bytes = *(start_addr-FLASHER_U32OFFSET_FLASH_WORD_BYTES);
    U32 uart_rx_gpio = *(start_addr-FLASHER_U32OFFSET_UART_RX_GPIO);
    U32 uart_tx_gpio = *(start_addr-FLASHER_U32OFFSET_UART_TX_GPIO);
    U32  data_bytes = FLASH_REPORT_BYTES;
    char command[256];
#else
    U32  flash_base = FLASH_BASE_ADDRESS;
    U32  flash_offset = FLASH_ADDRESS_OFFSET;
    U32  next_offset = FLASH_ADDRESS_OFFSET;
    U32  data_bytes = FLASH_REPORT_BYTES;
    U32  gap_flag = FLASH_ADDRESS_GAP_FLAG;
    U32 word_bytes = FLASH_DATA_WORD_BYTES;
    char command[256];
#endif
    FlashDumpInit();
    FlashDumpPrintf( "                        \n" );
    FlashDumpPrintf( "==========================================================\n" );
    FlashDumpPrintf( "%s v%s (%s) - %s\n", FLASHDUMP_PROGRAM_NAME, FLASHDUMP_PROGRAM_VERSION, FLASHDUMP_PROGRAM_DATE
                                           , FLASHDUMP_PROGRAM_TIME );
    FlashDumpPrintf( "%s\n", FLASHDUMP_PROGRAM_BRIEF );
    FlashDumpPrintf( "(C) Copyright 2005 by Goke Microelectronics China \n" );
    FlashDumpPrintf( "==========================================================\n" );

    while( 1 )
    {
        FlashDumpPrintf( "\n" );
        FlashDumpPrintf( "----- Settings --------------------------\n" );
        FlashDumpPrintf( "Flash base address...........: 0x%08x\n", flash_base );
        FlashDumpPrintf( "Flash address offset.........: 0x%08x\n", flash_offset );
        FlashDumpPrintf( "Flash data word size.........: %d bytes\n", word_bytes );
        FlashDumpPrintf( "Flash address gap mode.......: %s\n", gap_flag?"on":"off" );
        FlashDumpPrintf( "Report data count............: %d bytes\n", data_bytes );
        FlashDumpPrintf( "-----------------------------------------\n" );
        FlashDumpPrintf( "\n" );
        FlashDumpPrintf( "----- Commands --------------------------\n" );
        FlashDumpPrintf( "[b] = change flash base address (hex)\n" );
        FlashDumpPrintf( "[o] = change flash address offset (dec)\n" );
#ifdef SFLASH_SUPPORT
        FlashDumpPrintf( "[w] = change flash data word size (1,2,4)\n" );
#else
        FlashDumpPrintf( "[w] = change flash data word size (1,2)\n" );
#endif
        FlashDumpPrintf( "[g] = change flash address gap mode (0,1)\n" );
        FlashDumpPrintf( "[r] = change report data count\n" );
//      FlashDumpPrintf( "[e] = erase entire flash memory\n" );
        FlashDumpPrintf( "[d] = dump 1st block of flash memory\n" );
        FlashDumpPrintf( "[n] = dump next block of flash memory\n" );
        FlashDumpPrintf( "[p] = dump previous block of flash memory\n" );
        FlashDumpPrintf( "[x] = exit program\n" );
        FlashDumpPrintf( "-----------------------------------------\n" );
        FlashDumpPrintf( "\n" );
        
        GM_PrStr( "Enter command -> " );
        GM_LimScanStr( command, 1 );
        GM_PrStr( "\n" );
        switch( command[0] )
        {
            case 'b' :
            case 'B' :
                GM_PrStr( "\nFlash base address (hex) -> " );
                GM_ScanNum( "%x", &flash_base );
            break;
            
            case 'o' :
            case 'O' :
                GM_PrStr( "\nFlash address offset (hex) -> " );
                GM_ScanNum( "%x", &flash_offset );
            break;
            
            case 'w' :
            case 'W' :
                while( 1 )
                {
#ifdef SFLASH_SUPPORT
                    GM_PrStr( "\nFlash data word size [1,2] bytes, [4] bytes for serial flash -> " );
                    GM_ScanNum( "%x", &word_bytes );
                    if( word_bytes == 1 || word_bytes == 2 || word_bytes == 4 )
                        break;
                    GM_PrStr( "\nERROR: word size out of range [1,2,4]\n" );
#else
                    GM_PrStr( "\nFlash data word size [1,2] bytes -> " );
                    GM_ScanNum( "%x", &word_bytes );
                    if( word_bytes == 1 || word_bytes == 2 )
                        break;
                    GM_PrStr( "\nERROR: word size out of range [1,2]\n" );
#endif
                }
            break;
            
            case 'g' :
            case 'G' :
                while( 1 )
                {
                    GM_PrStr( "\nFlash address gap mode (0=off, 1=on) -> " );
                    GM_ScanNum( "%x", &gap_flag );
                    if( gap_flag == 0 || gap_flag  == 1 )
                        break;
                    GM_PrStr( "\nERROR: gap size out of range [0..1]\n" );
                }
            break;
            
            case 'r' :
            case 'R' :
                while( 1 )
                {
                    GM_PrStr( "\nReport data count (256,512,1024 bytes) -> " );
                    GM_ScanNum( "%d", &data_bytes );
                    if( data_bytes == 256 || data_bytes == 512 || data_bytes == 1024 )
                        break;
                    GM_PrStr( "\nERROR: data size out of range [256,512,1024]\n" );
                }
            break;
            
            case 'e' :
            case 'E' :        
                GM_PrStr( "Do you realy want to erase the entire flash [y/n] -> " );
                GM_LimScanStr( command, 1 );
                GM_PrStr( "\n" );
                if( command[0] == 'y' )
                {
                    next_offset = 0;
                    if( word_bytes == 1 ) 
                        FlashDumpErase8( flash_base, flash_offset, gap_flag );
                    if( word_bytes == 2 ) 
                        FlashDumpErase16( flash_base, flash_offset, gap_flag );
#ifdef SFLASH_SUPPORT
                    if( word_bytes == 4 ) 
                        FlashDumpErase32( flash_base, flash_offset, gap_flag );
#endif
                    FlashDumpReport( flash_base, next_offset, data_bytes, word_bytes, gap_flag );
                }
                else
                {
                    GM_PrStr( "Erasing flash canceled\n" );
                }
            break;
            
            case 'd' :
            case 'D' :        
                next_offset = flash_offset;
                FlashDumpReport( flash_base, next_offset, data_bytes, word_bytes, gap_flag );
            break;
            
            case 'n' :
            case 'N' :        
                next_offset += data_bytes;
                FlashDumpReport( flash_base, next_offset, data_bytes, word_bytes, gap_flag );
            break;
            
            case 'p' :
            case 'P' :        
                if( next_offset >= data_bytes )
                    next_offset -= data_bytes;
                FlashDumpReport( flash_base, next_offset, data_bytes, word_bytes, gap_flag );
            break;
            
            case 'x' :
            case 'X' :
                FlashDumpPrintf( "\nARC halted.\n" );
                _exit_halt();
            break;
            
            default: 
                GM_PrStr( "\nERROR: unknown command\n" );
            break;
        }
    }
}