add device type into manifest

This commit is contained in:
2026-04-09 22:10:28 +03:00
parent bd488454e1
commit d26a50a0d6
4 changed files with 75 additions and 2 deletions

View File

@@ -8,9 +8,14 @@ def main():
return
manifest_dir = sys.argv[1]
with open(manifest_dir + '/dev_type', 'r') as f:
dev_type = f.read()
mem_segments = []
out_manifest = {
'mem_segments': mem_segments
'mem_segments': mem_segments,
'dev_type': dev_type
}
with open(manifest_dir + '/seg_data.csv', 'r', newline='') as csvfile:

View File

@@ -0,0 +1,65 @@
#include "mem.h"
#include "mem_seg.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv)
{
if(argc != 2)
{
printf("provide target directory\n");
return 1;
}
const char *dirpath = argv[1];
const char *filename = "dev_type";
char *tgtpath = (char*)calloc(strlen(dirpath) + strlen(filename) + 1, sizeof(char));
if(tgtpath == NULL)
{
return 1;
}
sprintf(tgtpath, "%s/%s", dirpath, filename);
FILE *fptr;
fptr = fopen(tgtpath, "w");
if(fptr == NULL)
{
printf("errof opening file\n");
return 1;
}
int dev_type = DEVICE_TYPE;
int exitcode = 0;
switch (dev_type)
{
case EXTENDED_DEVICE_TYPE_DUMMY:
{
fprintf(fptr, "dummy");
break;
}
case EXTENDED_DEVICE_TYPE_INSTR_SIMUL:
{
fprintf(fptr, "instr_simul");
break;
}
default:
{
printf("invalid device type: %d\n", dev_type);
exitcode = 1;
}
}
fclose(fptr);
free(tgtpath);
return exitcode;
}