XilinxProcessorIPLib/drivers/aiengine/examples/aie_sim_test/ext/top/xaiesim_elfload.c
uint32 XAieSim_GetStackRange(uint8 *MapPtr, XAieSim_StackSz *StackSzPtr)
{
#ifdef __AIESIM__
	FILE *Fd;
	uint8 buffer[200U];

	/*
	 * Read map file and look for line:
	 * <init_address>..<final_address> ( <num> items) : Stack
	 */
	StackSzPtr->start = 0xFFFFFFFFU;
	StackSzPtr->end = 0U;

	Fd = fopen(MapPtr, "r");
	if(Fd == NULL) {
		XAieSim_print("ERROR: Invalid Map file\n");
		return XAIESIM_FAILURE;
	}

	while(fgets(buffer, 200U, Fd) != NULL) {
		if(strstr(buffer, "items) : Stack") != NULL) {
			sscanf(buffer, "    0x%8x..0x%8x (%*s",
					&StackSzPtr->start, &StackSzPtr->end);
			break;
		}
	}

	if(StackSzPtr->start == 0xFFFFFFFFU) {
		return XAIESIM_FAILURE;
	} else {
		return XAIESIM_SUCCESS;
	}
	fclose(Fd);
#endif
}
/*****************************************************************************/
/**
*
* This is the routine to derive the stack start and end addresses from the
* specified map file. This function basically looks for the line
* <b><init_address>..<final_address> ( <num> items) : Stack</b> in the
* map file to derive the stack address range.
*
* @param	MapPtr: Path to the Map file.
* @param	StackSzPtr: Pointer to the stack range structure.
*
* @return	XAIESIM_SUCCESS on success, else XAIESIM_FAILURE.
*
* @note		None.
*
*******************************************************************************/
This is the routine to derive the stack start and end addresses from the
specified map file. This function basically looks for the line
.. (  items) : Stack in the
map file to derive the stack address range.
This is the routine to derive the stack start and end addresses from the specified map file . This function basically looks for the line .. ( items ) : Stack in the map file to derive the stack address range .
uint32 XAieSim_GetStackRange(uint8 *MapPtr, XAieSim_StackSz *StackSzPtr)
{
#ifdef __AIESIM__
	FILE *Fd;
	uint8 buffer[200U];
	StackSzPtr->start = 0xFFFFFFFFU;
	StackSzPtr->end = 0U;
	Fd = fopen(MapPtr, "r");
	if(Fd == NULL) {
		XAieSim_print("ERROR: Invalid Map file\n");
		return XAIESIM_FAILURE;
	}
	while(fgets(buffer, 200U, Fd) != NULL) {
		if(strstr(buffer, "items) : Stack") != NULL) {
			sscanf(buffer, "    0x%8x..0x%8x (%*s",
					&StackSzPtr->start, &StackSzPtr->end);
			break;
		}
	}
	if(StackSzPtr->start == 0xFFFFFFFFU) {
		return XAIESIM_FAILURE;
	} else {
		return XAIESIM_SUCCESS;
	}
	fclose(Fd);
#endif
}
uint32 XAieSim_GetStackRange ( uint8 * MapPtr , XAieSim_StackSz * StackSzPtr ) { #ifdef __AIESIM__ FILE * Fd ; uint8 buffer [ 200U ] ; StackSzPtr -> start = 0xFFFFFFFFU ; StackSzPtr -> end = 0U ; Fd = fopen ( MapPtr , " " ) ; if ( Fd == NULL ) { XAieSim_print ( " \n " ) ; return XAIESIM_FAILURE ; } while ( fgets ( buffer , 200U , Fd ) != NULL ) { if ( strstr ( buffer , " " ) != NULL ) { sscanf ( buffer , " " , & StackSzPtr -> start , & StackSzPtr -> end ) ; break ; } } if ( StackSzPtr -> start == 0xFFFFFFFFU ) { return XAIESIM_FAILURE ; } else { return XAIESIM_SUCCESS ; } fclose ( Fd ) ; #endif }
This is the routine to derive the stack start and end addresses from the
specified map file.
This is the routine to derive the stack start and end addresses from the specified map file .
/*
	 * Read map file and look for line:
	 * <init_address>..<final_address> ( <num> items) : Stack
	 */