• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » Hercules™ Safety Microcontrollers » Hercules™ Safety Microcontrollers Forum » _get_CPSR not defined in halcogen example.
Share
Hercules™ Safety Microcontrollers
  • Forum
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

_get_CPSR not defined in halcogen example.

This question is answered
Cristiano Werner Araujo
Posted by Cristiano Werner Araujo
on Mar 28 2012 22:57 PM
Intellectual280 points

Hello,

I was trying to run the HalGoGen 3.0 example : example_freeRTOSBlinky using a RM48 HDK.

I've followed the screens on HalCoGen help. AJusted the Include and compiler settings on my IAR and I got the following error :

"Error[Li005]: no definition for "_get_CPSR" [referenced from C:\Hercules\IAR\HCG_FREERTOS_BLINKY\Debug\Obj\os_port.o] "

I've tried to do a workaround.

I've added this code to the os_portasm.asm

-----------------------

;Get CPSR register

       public vPortYield _get_CPSR

       

_get_CPSR

          mrs r1,cpsr

          bx lr

---------------------------

I also created a os_portasm.h and added the function stub:

#ifndef __OS_PORTASM__

#define __OS_PORTASM__

unsigned int _get_CPSR(void);

#endif

and included it on the os_port.c

There is any thing I'm missing ? is there some HalCoGen config that I've uset/not used that is messing up with the code.

Thanks,

Cristiano

/** @example example_freeRTOSBlinky.c*   This is an example which descibes the steps to create an example application which *   toggles the High End Timer (HET) pin 17 (LED in USB & HDK) based on the FreeRTOS timer tick of one second.**   @b Step @b 1:**   Create a new project.**   Navigate: -> File -> New -> Project**   @image html example_createProject.jpg "Figure: Create a new Project"**   @b Step @b 2:**   Configure driver code generation: *   - Enable GIO driver*   - Disable others**   Navigate: -> TMS570LS3137/RM48L950ZWT_FREERTOS -> Driver Enable**   @image html example_freeRTOSBlinky_enableDrivers_TMS570LS3x-RMx.jpg "Figure: Driver Configuration"**   @b Step @b 3:**   Configure Cortex-R4F IRQ handling: *   - Disable IRQ handling via VIC contoller*het*   Navigate: -> TMS570LS3137/RM48L950ZWT_FREERTOS -> Cortex-R4F**   @image html example_freeRTOSBlinky_cortexR4F.jpg "Figure: Cortex-R4F Configuration"**   @b Step @b 4:**   Configure Interrupt handling: *   - Enable SVC*   - Enter FreeRTOS SVC handler name 'vPortYieldProcessor'*   - Select IRQ dispatcher mode*   - Enter FreeRTOS IRQ handler name '_IsrStub'**   Navigate: -> TMS570LS3137/RM48L950ZWT_FREERTOS -> Interrupts**   @image html example_freeRTOSBlinky_interrupts.jpg "Figure: Interrupt Configuration"**   @b Step @b 5:**   Configure VIM RAM: *   - Enter FreeRTOS Timer Tick handler name 'vPreemptiveTick' at offset 0x0000000C**   Navigate: -> TMS570LS3137/RM48L950ZWT_FREERTOS -> VIM RAM**   @image html example_freeRTOSBlinky_VimRam.jpg "Figure: VIM RAM Configuration"**   @b Step @b 6:**   Configure Vectored Interrupt Module Channels: *   - Enable VIM Channel 2*   - Map VIM Channel 2 to IRQ**   Navigate: -> TMS570LS3137/RM48L950ZWT_FREERTOS -> VIM Channel 0-31**   @image html example_freeRTOSBlinky_vimChannelView.jpg "Figure: VIM Channel Configuration"**   @b Step @b 7:**   Configure OS timer tick to 1 ms: *   - Enter Tick Rate of 1000**   Navigate: -> OS -> General**   @image html example_freeRTOSBlinky_osGeneral.jpg "Figure: OS General Configuration"**   @b Step @b 8:**   Generate code**   Navigate: -> File -> Generate Code**   @image html example_freeRTOS_generateCode.jpg "Figure: Generate Code"**   @b Step @b 9:**   Copy source code below into your application.**   The example file example_freeRTOSBlinky.c can also be found in the examples folder: ../HALCoGen/examples**   @note HALCoGen generates an enpty main function in sys_main.c, *         please make sure that you link in the right main function or copy the source into the user code sections of this file.**/
/* Include common header file - types, definitions and function declarations for all drivers */#include "sys_common.h"
/* Include system header file - types, definitions and function declarations for system driver */#include "system.h"
/* Include FreeRTOS scheduler files */#include "FreeRTOS.h"#include "os_task.h"
/* Include HET header file - types, definitions and function declarations for system driver */#include "het.h"#include "esm.h"
/* Define Task Handles */xTaskHandle xTask1Handle;
/* Task1 */void vTask1(void *pvParameters){    for(;;)    {        /* Taggle HET[1] with timer tick */        gioSetBit(hetPORT1, 17, gioGetBit(hetPORT1, 17) ^ 1);        vTaskDelay(100);    }   }
/* ESM interrupt notification (Not used but must be provided) */void esmGroup1Notification(unsigned channel){}void esmGroup2Notification(unsigned channel){}
/* GIO interrupt notification (Not used but must be provided) */void gioNotification(int bit){    return;}

/* USER CODE END */

/** @fn void main(void)*   @brief Application main function*   @note This function is empty by default.**   This function is called after startup.*   The user can use this function to implement the application.*/
/* USER CODE BEGIN (2) *//* USER CODE END */
void main(void){/* USER CODE BEGIN (3) */        /* Set high end timer GIO port hetPort pin direction to all output */    gioSetDirection(hetPORT1, 0xFFFFFFFF);

    /* Create Task 1 */    if (xTaskCreate(vTask1, (const signed char *)"Task1", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle) != pdTRUE)    {        /* Task could not be created */        while(1);    }
    /* Start Scheduler */    vTaskStartScheduler();
    /* Run forever */    while(1);/* USER CODE END */}

/* USER CODE BEGIN (4) */
/* USER CODE END */
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Prathap
    Posted by Prathap
    on Apr 02 2012 02:37 AM
    Verified Answer
    Verified by Cristiano Werner Araujo
    Expert6175 points

    Hi

    You are correct the CCS compiler will replace the "_get_CPSR" with "mrs r1,cpsr" which IAR tool do not.
    I have passed this comments to the HALCoGen team and will get it fixed in the upcoming releases.

    You have done what ever necessary to make the FreeRTOS port work on IAR, you should be able to use it with the change you made.

    Best Regards
    Prathap

    ~~~ If a post answers your question, please mark it with the"Verify Answer" button. ~~~

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Cristiano Werner Araujo
    Posted by Cristiano Werner Araujo
    on Apr 02 2012 23:44 PM
    Intellectual280 points

    Hello Prathap,

    thanks for yout attention,

    Althrough doing that, the Linker didn´t finded the _get_CPSR asm function, so I´ve done a litle workaround inserting the asm code inside the .h and removing it from the .asm,

    so my os_portasm.h is :


    #ifndef __OS_PORTASM__
    #define __OS_PORTASM__

    unsigned int _get_CPSR(void)
    {
    asm("mrs r1,cpsr \n");
    }

    #endif
    
    
    this compiled, but its not working yet, the startup code runs, but when it calls _cmain(), it jumps ( after executing some asm ) in the 0x04 address and stays in loop. 
    I think it is something with the linker, but is unrelated with this topic.
    
    
    Thanks for your help,
    
    
    Cristiano W. Araújo
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prathap
    Posted by Prathap
    on Apr 03 2012 03:19 AM
    Expert6175 points

    Hi Christiano

    The return should always be on register "R0". I think if you change R1 to R0 it should work.
    My IAR licenese expired so could not give you a sample code, give me a day or two I will get back with a sample code.

    Best Regards
    Prathap

    ~~~ If a post answers your question, please mark it with the"Verify Answer" button. ~~~

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use