We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I found some demo applications on the website of TI, but it seems that those aren't working in Keil uVision, or with the headerfile I can download from the Keil site located here: http://www.keil.com/dd/chip/4070.htm
I was wondering if I can find somewhere any demo codes, like GPIO, CAN and SPI for this microcontroller using Keil uVision. Does anyone here has some demo code/examples available?
Thanks a lot.
IAR has most likely an header file that defines a macro or inline function for __IO_REG32_BIT.
And also for __TID__ - and the #if is there to ensure that it is appropriately defined!
As should be expected, if __TID__ is not appropriately defined, it doesn't work!
So, what you need to do is to provide an appropriate definition for __TID__ - not just remove the test that checks for it!
And all the other definitions...
The Reinhard is right the IAR header has defined all registers by macro __IO_REGS32_BIT which is as follows:
#define __IO_REG32_BIT(NAME,ADDRESS,ATTRIBUTE,IT_STRUCT)\ volatile __no_init ATTRIBUTE union \ { \ unsigned long NAME; \ BIT_STRUCT NAME ## _bit; \ } @ ADDRESS;
this macro can not be used in Keil (ARM) tools as it uses IAR specific directives and names like _bit, @ .
So, you can not include IAR's header directly, we at Keil already have register definition header file which is in folder Keil\ARM\INC\TI\TMS470R1.h which is prepared for Keil tools.
So the code from IAR can not be directly included and built with Keil tools as some things are done differently.
My suggestion is to use Keils Blinky from folder Keil\ARM\Boards\TI\TMS470R1B1M\Blinky as a template and then build on it.
You can take IAR's .c source file for example for CAN setting and you can change register accesses in it for example
PCR = CLKDIV_2;
would for Keil be written as
pSM->PCR = CLKDIV_2;
but also tms470r1b1m_bit_definitions.h from IAR would have to be included for constants values.
Other way is that you make your own include file where registers would have to be defined like this:
#define PCR (*(volatile unsigned long *)(0xFFFFFD30))