C, 216 212 186 155155 145 Bytes
Just as a function that takes a matrix as input
f(int i,int **m){for(int a=0;a<i;a++){for(int b=0;b<i;b++){m[a][b]=((a+b+1==i)||(a==0&&b==0!a&&!b)||(a==i-1&&b==i-1))?1:0;printf("%d ",m[a][b]);}printfputs("\n");}} Sneaky Answer6 Bytes thanks to Conor O'Brien!
4 Bytes thanks to Zacharý!
Old Answer
main(int i){int**m=malloc(8*i);for(int a=0;a<i;a++){m[a]=malloc(4*i);for(int b=0;b<i;b++){m[a][b]=((a+b+1==i)||(a==0&&b==0)||(a==i-1&&b==i-1))?1:0;printf("%d ",m[a][b]);}printf("\n");}} Instead of taking an array of arguments in the main function, it uses the length of arguments instead so the input for a 4x4 matrix would be:
Old Answer
main(int c,char **v){int i=atoi(v[1]);int**m=malloc(8*i);for(int a=0;a<i;a++){m[a]=malloc(4*i);for(int b=0;b<i;b++){m[a][b]=((a+b+1==i)||(a==0&&b==0)||(a==i-1&&b==i-1))?1:0;printf("%d ",m[a][b]);}printf("\n");}} If only I could get rid of of those mallocs, I know C is not a great golfing language, but whatever!
Compiled with GCC on macOS Sierra.
Ungolfed
main(int i) { int **m = malloc(8 * i); // Create n*n matrix for(int a=0; a<i; a++) { // Iterate through rows m[a] = malloc(4 * i); // Allocate rows for(int b=0; b<i; b++) { // Iteratre columns // Add a 1 to cell if its start or finish, or diagnol m[a][b]=((a+b+1==i)||(a==0&&b==0)||(a==i-1&&b==i-1))?1:0; printf("%d ",m[a][b]); // Print cell } printf("\n"); // Print row } 
