📄 mkimage.c
字号:
/*
* Copyright (c) 1995,2000 TriMedia Technologies Inc.
*
* +------------------------------------------------------------------+
* | This software is furnished under a license and may only be used |
* | and copied in accordance with the terms and conditions of such |
* | a license and with the inclusion of this copyright notice. This |
* | software or any other copies of this software may not be provided|
* | or otherwise made available to any other person. The ownership |
* | and title of this software is not transferred. |
* | |
* | The information in this software is subject to change without |
* | any prior notice and should not be construed as a commitment by |
* | TriMedia Technologies . |
* | |
* | this code and information is provided "as is" without any |
* | warranty of any kind, either expressed or implied, including but |
* | not limited to the implied warranties of merchantability and/or |
* | fitness for any particular purpose. |
* +------------------------------------------------------------------+
*
* This program is sample memory image generator for
* testing the downloader library lib_load.a.
* All error checking is omitted (!)
*
*/
#ifdef __TCS__
#include "tmlib/TMDownLoader.h"
#else
#include "TMDownLoader.h"
#endif
#include "fcntl.h"
#ifndef O_BINARY
#define O_BINARY 0
#endif
main()
{
String filename = "MkImage.tm";
String imagename = "libload_image";
Int alignment, minimal_image_size;
Pointer image_base;
Int fd;
TMDwnLdr_Object_Handle handle;
TMDwnLdr_load_object_from_file(filename, Null, &handle);
TMDwnLdr_get_image_size(handle, &minimal_image_size, &alignment);
image_base= (Pointer)malloc(minimal_image_size);
TMDwnLdr_resolve_symbol(handle, "__syscall", 0xdeadb00b);
TMDwnLdr_relocate(handle,
(tmHostType_t) tmTmSimHost,
(Address) 0xefe00000, /* mmio base */
(UInt) 100000000, /* tm freq */
0,0x800000, /* download area */
TMDwnLdr_LeaveCachingToDownloader);
TMDwnLdr_get_memory_image(handle, image_base);
TMDwnLdr_unload_object(handle);
fd= open(imagename, O_CREAT | O_WRONLY | O_BINARY, 0777);
write(fd,image_base,minimal_image_size);
close(fd);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -