Skip to content

Instantly share code, notes, and snippets.

@fvollmer
Created July 20, 2019 16:45
Show Gist options
  • Save fvollmer/6c4c028e72edad6020b7c4ac72253293 to your computer and use it in GitHub Desktop.
Save fvollmer/6c4c028e72edad6020b7c4ac72253293 to your computer and use it in GitHub Desktop.
/* this is a simple hello world program */
#include <stdio.h>
static inline int readl(int *addr)
{
return *addr;
}
char __ramfs_runtime_data[1024];
char flash_block_array[1024];
int main(void)
{
printf("Hello, eCos world!\n");
printf("chip id: 0x%x\n" , readl(0xa0000000 + 0x18000000 + 0x0000)&0x0000FFFF);
printf("chip revision: 0x%x\n" , readl(0xa0000000 + 0x18000000 + 0x0000)&0x000F0000);
printf("package Options: 0x%x\n", readl(0xa0000000 + 0x18000000 + 0x0000)&0x00F00000);
printf("number of cores 0x%x\n" , readl(0xa0000000 + 0x18000000 + 0x0000)&0x0F000000);
printf("0:\n");
printf("core id low: 0x%x\n", readl(0xa0000000 + 0x18000000 + 0x0FF8));
printf("core id high: 0x%x\n", readl(0xa0000000 + 0x18000000 + 0x0FFC));
printf("2:\n");
printf("core id low: 0x%x\n", readl(0xa0000000 + 0x18002000 + 0x0FF8));
printf("core id high: 0x%x\n", readl(0xa0000000 + 0x18002000 + 0x0FFC));
printf("1:\n");
printf("core id low: 0x%x\n", readl(0xa0000000 + 0x18001000 + 0x0FF8));
printf("core id high: 0x%x\n", readl(0xa0000000 + 0x18001000 + 0x0FFC));
printf("2:\n");
printf("core id low: 0x%x\n", readl(0xa0000000 + 0x18002000 + 0x0FF8));
printf("core id high: 0x%x\n", readl(0xa0000000 + 0x18002000 + 0x0FFC));
printf("3:\n");
printf("core id low: 0x%x\n", readl(0xa0000000 + 0x18003000 + 0x0FF8));
printf("core id high: 0x%x\n", readl(0xa0000000 + 0x18003000 + 0x0FFC));
printf("4:\n");
printf("core id low: 0x%x\n", readl(0xa0000000 + 0x18004000 + 0x0FF8));
printf("core id high: 0x%x\n", readl(0xa0000000 + 0x18004000 + 0x0FFC));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment