-
Notifications
You must be signed in to change notification settings - Fork 0
Debugging Baremetal Applications Using nSIM
nSIM supports running and debugging applications for all ARC families. Debugging is not supported for ARCv3 families yet.
Consider a simple example code (save it as main.c):
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}You need to use -specs=nsim.specs to use input/output features and to pass -on nsim_emt option to nSIM to use ARC GNU input/output protocol:
$ arc-elf32-gcc -mcpu=archs -specs=nsim.specs main.c -o main.elf
$ nsimdrv -tcf $NSIM_HOME/etc/tcf/templates/hs38_full.tcf -on nsim_emt main.elf
Hello, World!
You can use MetaWare's own hostlink protocol for input/output operations by passing -specs=hl.specs to GCC. In this case you don't have to pass any additional options to nSIM:
$ arc-elf32-gcc -mcpu=archs -specs=hl.specs main.c -o main.elf
$ nsimdrv -tcf $NSIM_HOME/etc/tcf/templates/hs38_full.tcf main.elf
Hello, World!
You can run nSIM in NCAM mode - Near Cycle-Accurate Mode. This mode activates counters that depend on micro-architectural simulations. It may be a good tool for optimization and exploration. NCAM's model is not cycle-accurate and it's not derived from RTL, but it's much faster than xCAM. If you need a cycle-accurate model then consider using xCAM models.