-
Notifications
You must be signed in to change notification settings - Fork 6
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
Freertos working commands #409
base: v2-staging
Are you sure you want to change the base?
Conversation
@npetersen2 ready for review @codecubepi please review code location under the |
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.
Thanks @Known4225 , I think this is great! I reviewed each file that changed and left some comments as appropriate.
Overall, there are several small things I'd like you to do, but in general, this is looking pretty close to merging from my perspective.
Let's see what @codecubepi has to say in his review
sdk/FreeRTOS-Kernel
Outdated
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.
It appears the .gitmodules
has to been changed, so why this change for the submodule here?
We should be trying to keep to named version releases from FreeRTOS---which version number does this change correspond to?
#define SERIAL_UPDATES_PER_SEC (10000) | ||
#define SERIAL_INTERVAL_USEC (USEC_IN_SEC / SERIAL_UPDATES_PER_SEC) | ||
#define SERIAL_INTERVAL_TICKS (pdMS_TO_TICKS(1000.0 / SERIAL_UPDATES_PER_SEC)) |
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.
Include header for pdMS_TO_TICKS
macro
sdk/shared/sys/serial.c
Outdated
// Create serial task | ||
xTaskCreate(serial_main, (const char *) "uartSerial", configMINIMAL_STACK_SIZE, | ||
NULL, tskIDLE_PRIORITY, &xSerialTaskHandle); |
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.
Let's make a new header file that has all the task priorities in one place so we can reason about how the system operates easily.
Let's call it sys/task_priority.h
and define priority there, then include and reference these defines in this file from each place that tasks are created.
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.
Note: this comment applies to all the FreeRTOS tasks you have added, not just this one! There should be numerous priorities defines in this new file.
sdk/shared/sys/intr.h
Outdated
#include <stdint.h> | ||
#include <stdio.h> | ||
|
||
// test |
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.
Remove this line
sdk/shared/sys/intr.h
Outdated
// Interrupt Controller Instance | ||
// Defined here to be accessable in sys/icc.c | ||
XScuGic InterruptController; |
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.
Scary scary! We should not be defining objects in header files.
Who "owns" this object? Where does this object live?
This code probably already was there before this PR... but I see you moved static
.
Either way, we need to move this to a single .c
file, then expose a extern
declaration in the header
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 probably my bad...
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.
Interesting, why this empty file?
I suppose future modules you will port over will need this?
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.
It looks like this is replacing the old user_config.h
file? Perhaps this should be a shared/
resource going forward?
// Microseconds interval between when task is called | ||
// | ||
// This is what scheduler actually uses to run task, | ||
// but is generated via define above | ||
#define TASK_GAME_INTERVAL_USEC (USEC_IN_SEC / TASK_GAME_UPDATES_PER_SEC) |
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 noticed your game task has a different way of defining its interval_usec
stuff versus the other system tasks.
Eventually, we should be consistent on the "recommended" way of creating tasks.
If we want your game to be kept in the codebase for the full v2
release, we'll need to update this. Otherwise, if the game will get removed, it does not matter
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.
Yeah, do we need the "game" in the codebase? This could become confusing clutter in the future if it's not a required resource.
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.
Interesting commands here :)
sdk/freertos_app_cpu0/src/main.c
Outdated
} else { | ||
message_status = 2; | ||
xil_printf("CPU0 - FreeRTOS Hello World Example FAILED\r\n"); | ||
xil_printf("IF YOU'RE READING THIS THEN A TERRIBLE ERROR HAS OCCURRED!\n"); |
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.
Ha nice. :)
I am happy to keep this, but let's give the user a little more help here. Revise to say something about memory
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 need the deleted code to be kept as well, see above comment on deleted code. I think you can probably add a task for your own testing without deleting my tasks.
sdk/freertos_app_cpu0/src/main.c
Outdated
#if 1 | ||
// CPU0 ONLY: | ||
// This code is required to start CPU1 from CPU0 during boot. | ||
// | ||
// This only applies when booting from flash via the FSBL. | ||
// During development with JTAG loading, these low-level | ||
// calls in this #if block are not needed! However, we'll | ||
// keep them here since it doesn't affect performance... | ||
|
||
// Write starting base address for CPU1 PC. | ||
// It will look for this address upon waking up | ||
static const uintptr_t CPU1_START_ADDR = 0xFFFFFFF0; | ||
static const uint32_t CPU1_BASE_ADDR = 0x20080000; | ||
Xil_Out32(CPU1_START_ADDR, CPU1_BASE_ADDR); | ||
|
||
// Waits until write has finished | ||
// DMB = Data Memory Barrier | ||
dmb(); | ||
|
||
// Wake up CPU1 by sending the SEV command | ||
// SEV = Set Event, which causes CPU1 to wake up and jump to CPU1_BASE_ADDR | ||
__asm__("sev"); | ||
#endif | ||
|
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.
Let's keep this code
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.
Yes please keep... if this is deleted, we'll get nasty merge conflicts when I merge the dual-core stuff.
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.
Good work so far. However it looks like many of your files have either changed minimally or not at all, but are marked as changed, probably due to line endings. If you could revert these EOL changes it will minimize the number of files changed, make review much easier, and Git will not have to store/track meaningless changes.
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.
It looks like this is replacing the old user_config.h
file? Perhaps this should be a shared/
resource going forward?
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.
@npetersen2 Perhaps this should be a shared/
resource going forward?
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.
Perhaps this should be a shared/
resource?
// Microseconds interval between when task is called | ||
// | ||
// This is what scheduler actually uses to run task, | ||
// but is generated via define above | ||
#define TASK_GAME_INTERVAL_USEC (USEC_IN_SEC / TASK_GAME_UPDATES_PER_SEC) |
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.
Yeah, do we need the "game" in the codebase? This could become confusing clutter in the future if it's not a required resource.
sdk/freertos_app_cpu0/.project
Outdated
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.
Hmmm... we really need to determine a way to ditch these absolute paths :(
Probably fine for now though.
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.
Again, what was changed in this file? Line endings?
@Known4225 please be conscious when you commit files of exactly what is changing. I recommend using the Diff View under 'Source Control' in VS Code...
If the only thing changing is line endings, please don't commit the change :)
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.
See other comments on line endings
sdk/shared/FreeRTOS_tick_config.c
Outdated
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.
Line endings?
sdk/shared/README.md
Outdated
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.
Line endings
sdk/shared/sys/intr.h
Outdated
// Interrupt Controller Instance | ||
// Defined here to be accessable in sys/icc.c | ||
XScuGic InterruptController; |
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 probably my bad...
71beffc
to
759f8c5
Compare
…obber each other and the lights look funny, but this is expected behaviour
Changes:
|
This temporary branch implements the following features in freertos: