-
Notifications
You must be signed in to change notification settings - Fork 26
Support for FlexPRET platform #412
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
1acedd7
Add support for FlexPRET
magnmaeh eb79720
Add FlexPRET to error message
magnmaeh cacaff1
Add check on number of threads available in FlexPRET's hardware.
magnmaeh 74fc601
Fixes to CMakeLists
magnmaeh 14ed735
Fix bug: lf_available_cores() needs to return 1 less than FP_THREADS.
magnmaeh 3bd8a10
Fix typo
magnmaeh 1afab56
Add hacky solution to code size for FlexPRET.
magnmaeh bd54f00
Remove wrap hack and instead filter out newlib functions that cause l…
magnmaeh cc6163e
Fix small bug
magnmaeh b1b9a91
Minor fixes
magnmaeh 50af7d4
Remove unecessary link in platform impl CMakeLists.txt
magnmaeh 6900207
Merge branch 'main' into flexpret-support
magnmaeh 596a344
Propagate low-level-platform interface to platform interface
magnmaeh e04610b
Merge branch 'flexpret-support' of github.com:magnmaeh/reactor-c into…
magnmaeh 0366a73
Apply formatter
magnmaeh 4764f1f
Add guard to flexpret_support.c which solves build errors for Ardunio…
magnmaeh 9c5baec
Revert changes to propagating low-level-platform interface
magnmaeh 9fdd189
Move a single CMake line for more consistency
magnmaeh e5216b6
Add explanation of #include platform in util.c
magnmaeh 2041aff
Fix author in lf_flexpret_support.h
magnmaeh c518fd4
Alphabetical order on targets supported
magnmaeh d388cac
Add link to issue of decide between HRTT and SRTT in lf_thread_create.
magnmaeh 7aecb2a
Fix 64-bit sleep and fix issues addressed in PR
magnmaeh 9110250
Remove more redundant code
magnmaeh 64f9339
Add workflow
magnmaeh 81aa462
Formatting
magnmaeh 09491de
Merge branch 'main' into flexpret-support
magnmaeh 414cbba
Fix issues that came from cmake changes in fp SDK
magnmaeh d36cf28
Merge branch 'flexpret-support' of github.com:magnmaeh/reactor-c into…
magnmaeh b879063
Merge branch 'main' into flexpret-support
magnmaeh bb0a90b
Format fix
magnmaeh 2e22d11
Merge branch 'main' into flexpret-support
magnmaeh 9a28f5e
Rename NO_TTY -> NO_CLI and fix comments related to this.
magnmaeh 9962705
Fix issue with vfprintf getting wrong declaration for FlexPRET.
magnmaeh 8fff5f0
Fix merge conflict
magnmaeh 3015a0d
Uncomment reference to FlexPRET workflow file that does not exist in …
magnmaeh 3bd9121
Try to run FlexPRET tests in CI
magnmaeh 35ffd7b
Fix url to point at fork
magnmaeh b230677
Revert ref to master
magnmaeh 869d786
Revert changes to CI and add warning about FlexPRET issue in lf_flexp…
magnmaeh 5b3a093
Add back flexpret CI
erlingrj 538cf9f
Merge branch 'main' into flexpret-support
erlingrj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* FlexPRET API support for the C target of Lingua Franca. */ | ||
|
||
/************* | ||
Copyright (c) 2021, The University of California at Berkeley. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY | ||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | ||
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
***************/ | ||
|
||
/** | ||
* FlexPRET API support for the C target of Lingua Franca. | ||
* | ||
* @author{Magnus Mæhlum <[email protected]>} | ||
*/ | ||
|
||
#ifndef LF_FLEXPRET_SUPPORT_H | ||
#define LF_FLEXPRET_SUPPORT_H | ||
|
||
#include <flexpret/flexpret.h> | ||
|
||
/** | ||
* Like nRF52, for FlexPRET, each mutex will control an interrupt. | ||
* | ||
* The mutex holds the interrupt number. | ||
* For example, a mutex might be defined for the GPIOTE peripheral interrupt number | ||
* | ||
* When initialized, the interrupt is inserted into a global linked list | ||
* for disabling and enabling all interrupts during sleep functions. | ||
* - All interrupts are disabled by default after initialization | ||
* - Priority levels are restricted between (0-7) | ||
* | ||
*/ | ||
|
||
#include <inttypes.h> // Needed to define PRId64 and PRIu32 | ||
#define PRINTF_TIME "%" PRId64 | ||
#define PRINTF_MICROSTEP "%" PRIu32 | ||
|
||
// For convenience, the following string can be inserted in a printf | ||
// format for printing both time and microstep as follows: | ||
// printf("Tag is " PRINTF_TAG "\n", time_value, microstep); | ||
#define PRINTF_TAG "(%" PRId64 ", %" PRIu32 ")" | ||
|
||
#if !defined(LF_SINGLE_THREADED) | ||
typedef fp_lock_t lf_mutex_t; | ||
typedef fp_thread_t lf_thread_t; | ||
typedef fp_cond_t lf_cond_t; | ||
#endif | ||
|
||
// This will filter out some unecessary calls to standard library functions | ||
// and save code space | ||
#define NO_CLI | ||
#define MINIMAL_STDLIB | ||
|
||
/** | ||
* Need to include `stdio` here, because we #define `fprintf` and `vfprintf` below. | ||
* Since stdio.h contains declarations for these functions, including it | ||
* after will result in the following: | ||
* | ||
* #define fprintf(s, f, ...) printf(f, ##__VA_ARGS__) | ||
* | ||
* int fprintf (FILE *__restrict, const char *__restrict, ...) | ||
* _ATTRIBUTE ((__format__ (__printf__, 2, 3))); | ||
* | ||
* Which the preprocessor will replace with: | ||
* | ||
* int printf (FILE *__restrict, const char *__restrict, ...) | ||
* _ATTRIBUTE ((__format__ (__printf__, 2, 3))); | ||
* | ||
* Which will yield an error. | ||
* | ||
*/ | ||
#include <stdio.h> | ||
|
||
// Likewise, fprintf is used to print to `stderr`, but FlexPRET has no `stderr` | ||
// We instead redirect its output to normal printf | ||
// Note: Most compilers do not support passing this on the command line, so CMake | ||
// will drop it if you try... But that would be the better option. | ||
#define fprintf(stream, fmt, ...) printf(fmt, ##__VA_ARGS__) | ||
#define vfprintf(fp, fmt, args) vprintf(fmt, args) | ||
|
||
#endif // LF_FLEXPRET_SUPPORT_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.