Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Project from scrap. Problems MCF51CN

2012-04-30
2013-09-16
1 2 > >> (Page 1 of 2)
  • Stephane Rey
    Stephane Rey
    2012-04-30

    Hi everybody,

    I'm trying to implement FreeRTOS for MCF51CN128.

    First I've tried the demo project which unfortunately doesn't compile. It sound impossible to compile as this demo intended for Coldfire V1 seems to refer to some MSP430 header files…. I've been unable to make something working with that and it made me more confused again.

    So I try to create a project from scrap and this is not straitfoward also.

    I've copied the FreeRTOS C files + includes + portable files (port.c + portasm.c + heap_2.c) into my project
    I've added the FreeRTOSconfig.h to my sources files
    Now when compiling, it gives errors regarding fucntions
         - vApplicationTickHook
         - vApplicationStackOverflowHook
    from task.c which are not refered.
    In task.c their prototype is declared as extern.

    When looking at the demo project, I see these functions that I don't underestand what it is (not really documented) are defined in the main.c file !

    So my questions are:
    - Are they part of the FreeRTOS kernel as they are called by task.c ? If so why are they located in main.c ? I don't understand the basic idea behind having a kernel supposed to be portable, with calls to functions declared in a demo project in main.c. How can the user now that it is and how to implement if ?

    - Does anyone has achieved to use freeRTOS on MCF51CN128 or to correct the demo project ?

    Any help appreciated.
    Cheers
    Stephane
    -

     
  • Richard
    Richard
    2012-04-30

    First I've tried the demo project which unfortunately doesn't compile.

    I assure you that, when used with the compiler/IDE it was created with, it does compile.

    It sound impossible to compile as this demo intended for Coldfire V1 seems to refer to some MSP430 header files

    Umm, not it doesn't, but I can see why you might come to that conclusion.

    I have just spent x hours downloading and installing the extraordinarily massive Eclipse version of the CodeWarrior tools, and was pleased to see it includes an import wizard.  I was even more pleased when I saw that it appeared to import the classic IDE project without error.  I was less pleased when I realised it only thought it had imported it.  When I tried to build it I get the error:

    "the file msp430.h cannot be opened".

    It says that, because it is not including the correct version of portmacro.h.

    Now, looking at the include paths I see that "${CW_Project}\..\..\Source\portable\CodeWarrior\ColdFire_V1" is mentioned, and that is indeed where the correct version of portmacro.h lives, so why it is attempting to use the one from the Source\portable\GCC\msp430 one is a mystery, especially as the project explorer even shows the correct file being used, and right clicking on the header file in the include directive also takes you to the correct place.  I think there is some strange dependency scanner issue in the tools (not unusual with Eclipse).

    So, I deleted every other copy of portmacro.h (there is one per port), and tried compiling again.  Now it is generating an error because it can't find a file that is part of the PIC18 port - so that seems like a good point to give up, but I'm in the mood for a challenge, so…

    I deleted all the files related to every other port, created a new workspace, and imported the classic project one more time, and hey presto - it built without any errors or warnings this time.  I have no idea if it runs, but it builds.

    So, go back to the original, unmodified, V1 project as found in the FreeRTOS download.  Then, in the FreeRTOS\source\portable directory, delete every directory other than the following:

    FreeRTOS\portable\MemMang
    FreeRTOS\portable\CodeWarrior\ColdFire_V1

    Then, delete heap_1.c and heap_2.c from FreeRTOS\portable\MemMang, make sure your Ecplise workspace is completely clean of any trace of the first attempt at importing the project (preferably use a new workspace), and finally use the CodeWarrior import wizard to import the original .mcp file again, and you should be all set.

    Now when compiling, it gives errors regarding fucntions
         - vApplicationTickHook
         - vApplicationStackOverflowHook
    from task.c which are not refered.
    In task.c their prototype is declared as extern.

    Look up hook functions in the documentation.  You either need to configure FreeRTOSConfig.h not to look for these functions, or you need to define them.

    don't understand the basic idea behind having a kernel supposed to be portable, with calls to functions declared in a demo project in main.c

    These are application definable hook functions (or callback functions, if you prefer).  They are not part of the kernel, but allow the application writer to add code into certain kernel events, if they want to.

    Regards.

     
  • Stephane Rey
    Stephane Rey
    2012-05-01

    Hi,

    Many thanks for this long, detailled and valuable answer.

    I'm going to try right now to isolate the dedicated files needed for this demo project and compile. I'll let you know.
    However I'm using Codewarrior 6.3 "classic version" and it sounds like you had the same behavior with CW 10.2 under Eclispe. This might be then a problem affecting both version.  Good to know.

    Regarding my question for the two calls to Hook functions, I would say that for someone not knowing FreeRTOS like me and trying to use it for the first time, this would be better to have a demo project very minimalist like just blinking few leds in order to understand the core and how to use it.  This is what I'm trying to set.
    Then more complex projects could be good when starting to code applications.

    But for running FreeRTOS for the first time I would think that a very very simple project showing what are the minimum functions and files to use would be easier and faster to start with, providing then a template frame for new projects. I have to admit that this is quite difficult for me to understand each line/function of the demo project as this is already quite complex.

    Moreother, I would probably not reuse a demo project as a start for a new project but I would like to start a new project from scrap in order to include only the files and functions I need. This would definitely not be FMEA compliant otherwise.
    The documentation lists the minimum files requested for the kernel and based upon that I've tried to set a project. But Then I face the freeRTOSconfig.h and main.c files which are including much more things than requested to start with in demo projects.

    Well, back to Codewarriior and I'll let you know if I can both compile the demo project now and start my new project from scrap by tuning the freeRTOSconfig.h

    Thanks again
    Stéphane

     
  • Stephane Rey
    Stephane Rey
    2012-05-01

    maybe a note should be added in the FreeRTOS distribution in order to mention this problem of paths with codewarrior and that it is mandatory to copy the needed files somewhere else than the FreeRTOS path ?
    Stephane

     
  • Richard
    Richard
    2012-05-01

    However I'm using Codewarrior 6.3 "classic version"

    That is interesting, because I think the project was originally created with 6.2.2 according to the documentation page for that port.  The latest tools are V10.x.

    I would say that for someone not knowing FreeRTOS like me and trying to use it for the first time, this would be better to have a demo project very minimalist like just blinking few leds

    This is feedback which is often received, and why all newer demo projects have to configurations, a simple "Blinky" style demo, and a fully featured demo.  The ColdFire demos are relatively old, so pre-date that change though.

    There are also these demos too:
    http://www.freertos.org/simple-freertos-demos.html

    Moreother, I would probably not reuse a demo project as a start for a new project but I would like to start a new project from scrap in order to include only the files and functions I need.

    It is always recommended to start with an existing project, to save you time, and give a better "out of the box" experience more than anything, but I still understand the point.

    The pages that provide the most help are probably:
    http://www.freertos.org/FreeRTOS-porting-guide.html
    http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html

    Regards.

     
  • Stephane Rey
    Stephane Rey
    2012-05-01

    again thanks. I'm going to go deep inside these docs and try to set my simple project for V1.

    It seems there is a problem with the FreeRTOS.org website, I can't access anymore to the download page. (even for downloading the package or the simple FreeRTOS demos you pointed me.

    Stephane

     
  • Stephane Rey
    Stephane Rey
    2012-05-01

    ok, I could achieve to compile the demo project erasing everything and only keeping the following directories :
    - Demo\ColdFire_MCF51CN128_CodeWarrior
    - Demo\Common
    - Source\Portable\Codewarrior
    - Source\Portable\MemMang

    It might be useful to know for the ones who'd like to test this project.

    Now I'm going to focus on creating a minimalist project to start with. Then with these two projects It would be easier then to progress in more advanced functions.

    Thanks again
    Stéphane

     
  • Richard
    Richard
    2012-05-01

    It seems there is a problem with the FreeRTOS.org website, I can't access anymore to the download page. (even for downloading the package or the simple FreeRTOS demos you pointed me.

    The website has been completely updated, and there are some problems with cached pages.  Please delete your local cache in your browser, and try again.

    You might also be able to trick the browser into loading the page again by adding a query to the end of the URL, for example:

    http://www.freertos.org/a00104.html?dummy_string

    Regards.

     
  • Stephane Rey
    Stephane Rey
    2012-05-01

    well none of them are working. I've just tried from a station where I never wen to FreeRTOS.org and still can't access the download page.
    Stephane

     
  • Richard
    Richard
    2012-05-01

    well none of them are working

    To help me debug this I would be grateful if you could provide answer to all the following:

    What is happening when you try and open the page?

    Are you getting a URL like http://www.freertos.org/index.html?http://www.a00104.html?

    If you try it now, what happens?

    Regards.

     
  • Richard
    Richard
    2012-05-01

    The URL in my previous post is wrong, but the concept is write, a URL that goes to index, followed by a ? followed by the URL you want.

     
  • Stephane Rey
    Stephane Rey
    2012-05-01

    It sounds like you have modified sometthing. Initially I had an URL like you gave me above.
    Now, If I click on the download page, the link is http://www.freertos.org/a00104.html?1
    but it still open the page :

    "Please support the FreeRTOS project!
    The FreeRTOS project has been generated through many years of hard work - but is provided to you here free of charge. Please show your support by buying a book, or simply making a donation. Thank you.
    Documentation
    …."

     
  • Richard
    Richard
    2012-05-01

    but it still open the page :

    "Please support the FreeRTOS project!

    Ah - ok - this is the right page now.  The download link is just below that in the section "RTOS Source Code Downloads".  I take it that is not what was happening before.

    I changed a few things.  One was to put the dummy parameter on the end of the URL, and another was to try and catch the old FreeRTOS.org/index?actual_page.html formatted URLs with some javascript to strip off the beginning part.

    Anyway, it sounds like it is working now.  That is a relief, it was always a risk trying to remove the frames that people would run into this type of issue.  Thanks for reporting back.

    Regards.

     
  • Stephane Rey
    Stephane Rey
    2012-05-02

    Hi,
    Well, the demo project compiles but doesn't work.
    The code doesn't go into the timer interrupt for the scheduler…

    Well, I'm going to start a project from scrap. I'm spending too much time on the demo project without beeing able to make it working.
    Stephane

     
  • Dave
    Dave
    2012-05-02

    Note what was said before about the V2 compiler change causing problems, and the fix. If the demo compiles but does not run have you looked to see if the issue is the same?

     
  • Stephane Rey
    Stephane Rey
    2012-05-02

    Hi,

    Thanks for answering. However I do not understand your comment on the V2 compiler change ? Is it something discussed in the forum earlier ? I tried a search but found nothing in relation.

    Thanks
    Stephane

     
  • Stephane Rey
    Stephane Rey
    2012-05-02

    Thanks,

    Then I don't think this is related as I'm using the classic version of codewarrior 6.3 (not Eclipse based) and V1 core.

    Stephane

     
  • Richard
    Richard
    2012-05-02

    Did you clear your browser cache, as per a previous suggestion when the download page had a problem?

    Regards.

     
  • Stephane Rey
    Stephane Rey
    2012-05-02

    ah yes, emptying the cache has solved the problem.
    Sorry for the convenience.
    Regards
    Stephane

     
  • Stephane Rey
    Stephane Rey
    2012-05-03

    hi again.

    I've set a simple project with a blinking led… which does not !
    The timer interrupts (RTC) is working fine; but the code does never go into my task.

    Here is how I've created my task

    void main(void) {
         EnableInterrupts; /* enable interrupts */
         /* include your code here */
         prvSetupHardware();
         xTaskCreate( led1Task, (const signed char *)"T1", configMINIMAL_STACK_SIZE, NULL, (tskIDLE_PRIORITY ), NULL );
      
        /* Start the scheduler. */
        vTaskStartScheduler();
        /* Will only get here if there was insufficient memory to create the idle
        task. */
        for( ;; )
        {
        }
    }
    

    and this is my FreeRTOSconfig.h :

    #define configUSE_PREEMPTION                 1
    #define configUSE_IDLE_HOOK             1
    #define configUSE_TICK_HOOK             0
    #define configCPU_CLOCK_HZ              50000000UL
    #define configTICK_RATE_HZ              ( ( portTickType ) 100 )
    #define configMINIMAL_STACK_SIZE             ( ( unsigned short ) 200 )
    #define configTOTAL_HEAP_SIZE               ( ( size_t ) ( 13 * 1024 ) )
    #define configMAX_TASK_NAME_LEN         ( 12 )
    #define configUSE_TRACE_FACILITY            0
    #define configUSE_16_BIT_TICKS          0
    #define configIDLE_SHOULD_YIELD         1
    #define configUSE_CO_ROUTINES           0
    #define configUSE_MUTEXES               1
    #define configCHECK_FOR_STACK_OVERFLOW      0
    #define configGENERATE_RUN_TIME_STATS       0
    #define configUSE_RECURSIVE_MUTEXES     1
    #define configQUEUE_REGISTRY_SIZE           0
    #define configUSE_COUNTING_SEMAPHORES       0
    #define configMAX_PRIORITIES                ( ( unsigned portBASE_TYPE ) 6 )
    #define configMAX_CO_ROUTINE_PRIORITIES      ( 2 )
    /* Set the following definitions to 1 to include the API function, or zero
    to exclude the API function. */
    #define INCLUDE_vTaskPrioritySet            1
    #define INCLUDE_uxTaskPriorityGet           1
    #define INCLUDE_vTaskDelete             1
    #define INCLUDE_vTaskCleanUpResources       0
    #define INCLUDE_vTaskSuspend                1
    #define INCLUDE_vTaskDelayUntil         1
    #define INCLUDE_vTaskDelay              1
    #define INCLUDE_uxTaskGetStackHighWaterMark 1
    /* It is not advisable to change these values on a Coldfire V1 core. */
    #define configKERNEL_INTERRUPT_PRIORITY     1
    #define configMAX_SYSCALL_INTERRUPT_PRIORITY 7
    

    Any idea of what I've made wrong ?
    Thanks
    Stephane

     
  • Stephane Rey
    Stephane Rey
    2012-05-03

    which sounds like to be the same problem I had with the DEMO project…..
    Stephane

     
  • Stephane Rey
    Stephane Rey
    2012-05-03

    I could make FreeRTOS version 4.7 working with the same tasks creation. So the problem with v7 seems to be in configuration or whatever….
    Stephane

     
  • Stephane Rey
    Stephane Rey
    2012-05-03

    When I look a t the difference, I can see that the port.c became port.c + portasm.s
    One major difference in operation is that in the v7.1.0, the code never stops on Yield interrupt defined in portasm.s

    /* Yield interrupt. */
    _vPortYieldISR:
    vPortYieldISR:
        portSAVE_CONTEXT
        jsr _vPortYieldHandler
        portRESTORE_CONTEXT
    

    I notice that in the V4.7, the VectorNumber was :

    interrupt VectorNumber_Vtrap15 vPortYield( void )
    

    wereas this is in V7.1.0

    asm void interrupt VectorNumber_VL1swi vPortYieldISR( void );/code]
    How is called this VL1swi interrupt (which is in my case never called) ?
    I tried to replace by Vtrap15 without success...
    Stephane
    
     
1 2 > >> (Page 1 of 2)