|
NOTE:This is a read only archive of threads posted to the FreeRTOS support forum. Use these archive pages to search previous posts. New forum support threads can be started at the FreeRTOS forums.
FreeRTOS Support Archive
The FreeRTOS support forum can be used for active support both from Amazon Web Services and the community. In return for using our software for free, we request you play fair and do your bit to help others! Sign up for an account and receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum. Use these archive pages to search previous posts. New forum support threads can be started at the FreeRTOS forums.
[FreeRTOS Home]
[Live FreeRTOS Forum]
[FAQ]
[Archive Top]
[November 2016 Threads]
StaticEventGroup_t not foundPosted by nazwantsdiy on November 16, 2016 Hello,
I am trying to follow the example on how to create a static event group. I am using Xilinx SDK 2016.1 and a project with freeRTOS_823xilinx platform:
~~~
include “FreeRTOS.h”
include “task.h”
include “event_groups.h”
/* Declare a variable to hold the handle of the created event group. */
EventGroupHandle_t xEventGroupHandle;
/* Declare a variable to hold the data associated with the created
event group. */
StaticEventGroup_t xCreatedEventGroup; // ERROR HERE: UNKNOWN TYPE NAME
/* Attempt to create the event group. */
xEventGroupHandle = xEventGroupCreateStatic( &xCreatedEventGroup );
~~~
As commented in the code, the StaticEventGroup_t is not recognized. How to fix it?
StaticEventGroup_t not foundPosted by rtel on November 16, 2016 Static allocation was introduced in FreeRTOS version 9.
http://www.freertos.org/FreeRTOS-V9.html V9 is backward compatible, so
you should be able to copy the V9 files over the top of your V8 files.
StaticEventGroup_t not foundPosted by nazwantsdiy on November 16, 2016 I do not know how to change/update the SDK environment. The question above is a consequence of a problem that I started having when using freeRTOS. So, I though that switching to “static” would fix it. But maybe you could suggest what could be the problem in the following:
Xilinx SDK 2016.1 freeRTOS823_xlinx OS platform
My code seemed to work fine until I introduced some freeRTOS elements. The general functionality of my code as follows:
1. In the Interrupt subroutine, I assign a value to a variable focusPosition read from the IP register:
~~~
//separate file
u32 focusPosition=0;
static void ISR(void *CallbackRef)
{
focusPosition = XRb_focus_Get_position_o(CallbackRef);
}
~~~
2. Then I printf the value to the console in the main function:
~~~
//separate file
extern u32 focusPosition;
main{
…
while(1){
sleep(1);
xil_printf(“%dn”,focusPosition);
}
}
~~~
The code prints the correct value, however, when I try to implement some additional lines in the code, like xTaskCreate() xEventGroupCreate(), something messes up all the memory and the printed value stays constant, which is not correct.
How can simple addition of the code that has nothing to do with the variable have any influence on that variable? As far as I understand, the xTaskCreate() and xEventGroupCreate() are created on the heap. I tired pocking around to see if Xil_DCacheDisable() would help, but no. Any ideas? Is my focusPosition variable properly defined/declared?
StaticEventGroup_t not foundPosted by rtel on November 16, 2016 I don’t know what XRbfocusGetpositiono() is, or what it does, but
would agree that calling an unrelated function should probably have no
impact on it.
There are two things the FreeRTOS create functions do that touch the CPU
or run time state. The first is disable then re-enable interrupts –
could that impact XRbfocusGetpositiono()? The second is allocate
some RAM (which I am presuming is why you were looking to use a static
system). How RAM is allocated depends on which heapn.c implementation
you are using – see http://www.freertos.org/a00111.html Which are you
using? (heap1, heap2, heap3, heap4 or heap5?).
The only other mention of XRbfocusGetpositiono() I can find on the
web is on the following link – does the link provide any relevant
information?
https://forums.xilinx.com/t5/High-Level-Synthesis-HLS/Register-values-are-not-in-the-post-co-sim-wave-form/m-p/731757
StaticEventGroup_t not foundPosted by tlafleur on November 16, 2016 Many IDE or compiler library’s printf function are NOT RTOS compatible…..
a good place to start looking…
On Wed, Nov 16, 2016 at 10:00 AM Naz nazwantsdiy@users.sf.net wrote:
I do not know how to change/update the SDK environment. The question above
is a consequence of a problem that I started having when using freeRTOS.
So, I though that switching to “static” would fix it. But maybe you could
suggest what could be the problem in the following:
Xilinx SDK 2016.1 freeRTOS823_xlinx OS platform
My code seemed to work fine until I introduced some freeRTOS elements. The
general functionality of my code as follows:
1. In the Interrupt subroutine, I assign a value to a variable
focusPosition read from the IP register:
//separate file
u32 focusPosition=0;
static void ISR(void *CallbackRef)
{
focusPosition = XRb_focus_Get_position_o(CallbackRef);
}
- Then I printf the value to the console in the main function:
//separate file
extern u32 focusPosition;
main{
…
while(1){
sleep(1);
xil_printf(“%dn”,focusPosition);
}
}
The code prints the correct value, however, when I try to implement some
additional lines in the code, like xTaskCreate() xEventGroupCreate(),
something messes up all the memory and the printed value stays constant,
which is not correct.
How can simple addition of the code that has nothing to do with the
variable have any influence on that variable? As far as I understand, the
xTaskCreate() and xEventGroupCreate() are created on the heap. I tired
pocking around to see if Xil_DCacheDisable() would help, but no. Any ideas?
Is my focusPosition variable properly defined/declared?
StaticEventGroup_t not found
Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/freertos/discussion/382005/
To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/
StaticEventGroup_t not foundPosted by nazwantsdiy on November 16, 2016 The link you referred was my question regarding the same project, but for a different reason. The XRbfocusGetpositiono() is a custom function that is automatically created as a driver function for the IP block that is implemented in the programmable logic on the FPGA. This function works fine. The problem arises ONLY WHEN I introduce anything related to freeRTOS (or some other things that I am not aware yet).
1. I doubt that the XRbfocusGetpositiono() coud be affected. It simply accesses the IP block register and reads its value.
2. I tend to believe that your second suggestion is the reason. As you can see, the variable focusPosition is dealt with when wrinting to it (in ISR), and then when reading from it (in printf). I feel like the two functions access different physical addresses after I create any freeRTOS objects. I do not know which heap# is used in the my implementation. Whatever is set by SDK default settings…
StaticEventGroup_t not foundPosted by rtel on November 16, 2016 You should be able to see which heapn.c file is being used in the IDE.
Are you using the Xilinx SDK, which is Eclipse, if so and you are
using FreeRTOS as part of the BSP (rather than adding the files into
your project manually) then the heapn.c file will be listed along with
the other BSP files (in the BSP project, not the application project).
StaticEventGroup_t not foundPosted by nazwantsdiy on November 16, 2016 Indeed, the BSP libsrc folder contains heap_4.h. So, when I use functions like these – xTaskCreate() xEventGroupCreate() – they probably call heap functions to allocate memory. Is there a way to prevent them from interfering with other variable in my project?
StaticEventGroup_t not foundPosted by rtel on November 16, 2016
Is there a way to prevent them
from interfering with other variable in my project?
Its a bit of a non-question as there is of course no known reason why
they would interfere with your variables – so the task is to find out
why they are.
Heap 4.c is good as it is using a statically allocated array as the
heap. If you were using heap3.c it would be more complex as we would
have to look at the linker scripts.
The size of heap 4.c is set by the configTOTALHEAP SIZE constant found
in the FreeRTOSConfig.h file. If you are building FreeRTOS as part of
the BSP then the FreeRTOSConfig.h will be automatically generated. You
can set its value by editing the BSP settings through the IDE, but for
now just look at the file (it will be in the BSP project too) to see
what configTOTALHEAP_SIZE is set to. It is also possible to step
through the function to see what it does when you attempt to create a
FreeRTOS object – but you will need to set the optimisation level to 0
to make that easy. By default the BSP is built at optimisation level 2
– which with GCC makes things tricky to debug.
When you create an RTOS object are you actually checking the object is
created successfully? The easiest way of doing that is by checking the
return value of the function used to create the RTOS object. If it
returns pdFAIL (0) then the object was not created because the memory
allocation failed.
This is such an odd problem I suspect it has little to do with FreeRTOS,
so other questions to ask are:
1) Are you sure the linker script is correct for your hardware.
2) Are you sure the hardware itself is functioning as you expect. For
example if you do something more complex but not involving FreeRTOS
would the same issue eventually show up?
3) Are you sure the debugger is working as you expect – in particular –
are you sure the variable is REALLY behaving the way you say, and its
not just that the debugger can no longer read the varibable’s value.
4) Etc.
StaticEventGroup_t not foundPosted by nazwantsdiy on November 16, 2016 I think it is just something simple I don’t do right (because I am unexperienced).
So, #define configTOTAL HEAPSIZE ( ( size_t ) ( 65536 ) ), the number represents bytes or bits? That is, the allocated memory is 64kB or 8kB?
- The* focusPosition* is assigned a value in the interrupt subroutine:
~~~
//separate file
u32 focusPosition=0;
static void ISR(void CallbackRef)
{
focusPosition = XRb_focus_Get_position_o(CallbackRef);
}
~~~
2. The value of *focusPosition is out to the console in the while loop:
~~~
//separate file
extern u32 focusPosition;
int main{
…
while(1){
sleep(1);
xil_printf(“%dn”,focusPosition);
}
}
~~~
- The program starts “malfuctioning” after I simply uncomment the line that calls xEventGroupCreate():
~~~
//separate file
include “xil_printf.h”
include “FreeRTOS.h”
include “event_groups.h”
EventGroupHandle t RBEventGroup;
int RB THREADinit()
{
int Status=0;
//RB_EventGroup = xEventGroupCreate();
if( RB_EventGroup == NULL ){xil_printf("Event Group Create FAILED!n");}
return Status;
}
~~~
So, really there should be no change to the functionality of the program. I can not figre out why the program starts printing incorrect values of , after the line is uncommented.
StaticEventGroup_t not foundPosted by nazwantsdiy on November 17, 2016 After some investigation I found that the ISR is not executed anymore, so the variable is not updataed. At this point I think that the addition of the commented line affects the execution of ISR (it is not called). Why would this be the case?
StaticEventGroup_t not foundPosted by rtel on November 17, 2016 Ok – that makes more sense.
If you call a FreeRTOS API function before the scheduler has started
then FreeRTOS will deliberately leave interrupts disabled. That is done
to ensure no ISRs attempt to use FreeRTOS services before the scheduler
has been started. When you start the scheduler interrupts are
automatically re-enabled.
StaticEventGroup_t not foundPosted by nazwantsdiy on November 17, 2016 Hm… I am not sure I understood your reply correctly, but so far, it does not seem to hold:
1. My hardware initialization and interrup registration are congifured before calling any freeRTOS API function, and all the interrups work fine (for a second) until the API is called. After that, one of the interrupts is not called any more.
2. The interrups do not seem to be disabled before starting the scheduler, since I have other interrups that work fine, like VDMA block that moves video data between the memory and programmable logic.
3. The “Hello World” xilinx example calls xTaskCreate() and xQueueCreate() functions before vTaskStartScheduler().
To me – it’s a mystery.
Also, is it possible to prevent freeRTOS from affecting the interrupts? My application goal is to have interrups running when needed, and I would like to flag the events in the interrupts. Then, I would have two threads running and executing necessary code when the events is set.
StaticEventGroup_t not foundPosted by rtel on November 17, 2016
Hm… I am not sure I understood your reply correctly, but so far, it
does not seem to hold:
1. My hardware initialization and interrup registration are congifured
before calling any freeRTOS API function, and all the interrups work
fine (for a second) until the API is called. After that, one of the
interrupts is not called any more.
Yes – the C start up code will no doubt enable interrupts.
- The interrups do not seem to be disabled before starting the
scheduler, since I have other interrups that work fine, like VDMA block
that moves video data between the memory and programmable logic.
After you call a FreeRTOS API function interrupts that have a priority
at or below
configMAX SYSCALLINTERRUPT PRIORITY/configMAXAPI CALLINTERRUPT_PRIORITY
will be disabled, and interrupts that have a priority above that will
still be enabled. So what you are reporting is completely expected IF
the interrupt that is still running has a priority high enough.
Google running FreeRTOS on a Cortex-A microcontroller (is that what you
are using? I’m not viewing the forum at the moment so that is from
memory) to find the page on the FreeRTOS.org site that explains this.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|
|