-
Notifications
You must be signed in to change notification settings - Fork 8
Add MINIMISE_MAIN_TILE_ARGS define in tile_map.xc #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…es on 2 tile applications
|
I have thought a little about this and the change I have been thinking of would be Where Benefit of this is that it could easily be extended to support arbitrary tiles which the XTC tools support. A further thought which might be worth considering. The XTC tools support passing command line parameters through That's getting unwieldy again for the newcomer though. Maybe some clever macro magic could solve everything? |
|
|
||
|
|
||
| // c3 | ||
| #if ((PLATFORM_SUPPORTS_TILE_3 == 1) && (PLATFORM_USES_TILE_3 == 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good to have the function prototypes in a header file. This could then be included by the C file which defines the functions. This allows the user to get compile time (as opposed to link time) errors when they define it incorrectly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great suggestion. I have updated the PR to include a new header file main_tile.h which provides this.
|
|
||
| // c3 | ||
| #if ((PLATFORM_SUPPORTS_TILE_3 == 1) && (PLATFORM_USES_TILE_3 == 1)) | ||
| #ifdef ARGS_STARTED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions whose prototype changes based on macro definitions cause confusion IMO. You need to run the preprocessor on this code before you can know what the function you need to define is.
Open to being persuaded otherwise if there are reasons behind doing it this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would usually agree on this point and I agree it's not a perfect solution. However, I put in two mitigations:
- I added text to the README describing what I believe will be the most common setup (a two-tile system). The README is ordered so that users wanting the simple prototypes get the prototypes and all the information they need to configure the build to use those prototypes.
- The proposed changes are guarded by the define MINIMISE_MAIN_TILE_ARGS. If this is not set the prototypes are unchanged.
…customer's application code which will cause errors to be spotted at compile time
The current tile_map.xc usage provides flexibility but is a little unfriendly for 2 tile applications. The proposed change maintains the existing prototypes for the main_tilen entry points unless MINIMISE_MAIN_TILE_ARGS is defined during preprocessing.
When MINIMISE_MAIN_TILE_ARGS is defined, the preprocessing removes all unused chanends from the prototypes. For a 2 tile application (tiles 0 and 1) the preprocessed tile main becomes:
extern "C" {
void main_tile0(chanend c1);
void main_tile1(chanend c0);
}
int main(void) {
chan c_t0_t1;
par {
on tile[0] : main_tile0(c_t0_t1);
on tile[1] : main_tile1(c_t0_t1);
}
return 0;
}
This is likely to be a more palatable starting point for new customers.
Marking as work in progress as there are not automated tests.