| /******************************************************************************** |
| * Marvell GPL License Option |
| * |
| * If you received this File from Marvell, you may opt to use, redistribute and/or |
| * modify this File in accordance with the terms and conditions of the General |
| * Public License Version 2, June 1991 (the "GPL License"), a copy of which is |
| * available along with the File in the license.txt file or by writing to the Free |
| * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or |
| * on the worldwide web at http://www.gnu.org/licenses/gpl.txt. |
| * |
| * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED |
| * WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY |
| * DISCLAIMED. The GPL License provides additional details about this warranty |
| * disclaimer. |
| ******************************************************************************/ |
| |
| #include <stdio.h> |
| #include <stdlib.h> |
| //#include <file.h> |
| |
| int main( void ) |
| { |
| FILE *fr, *fw; |
| int data, size, i; |
| |
| printf( "hello world\n" ); |
| |
| fr = fopen( "figo_sram.bin", "r" ); |
| fw = fopen( "figo_sram_bin.c", "w" ); |
| // fw = fopen( "build/SM_Code.c", "w" ); |
| |
| if (NULL == fr || NULL == fw) |
| { |
| printf("can't open files!\n"); |
| return -1; |
| } |
| |
| fprintf( fw, "#include \"com_type.h\"\n\nunsigned int FIGO_Sram_Code[]= {\n" ); |
| |
| for( i = 0 ; ; i ++ ) |
| { |
| size = fread( &data, 1, 4, fr ); |
| if( size == 0 ) break; |
| |
| fprintf( fw, "0x%8.8x, ", data ); |
| if( i % 8 == 7 ) |
| fprintf( fw, "\n" ); |
| } |
| |
| fprintf( fw, "};\n\nunsigned int Figo_Sram_Code_Size = %d;\n", i ); |
| |
| fclose( fr ); |
| fclose( fw ); |
| |
| return 0; |
| } |