3

I have a project that includes "main.c" where I need to change a few hard variables, but my company has long since lost contact with the contracted coder who wrote the code. The source files I received include .dtp, .prj, .c, and .r43 file types and the IC is the MSP430F437IPZ. I have a license for IAR and one non-technical person here told me that might be what the contractor was using.

I cannot open the dtp/prj in IAH or code composer or import them, and when I copy/paste in the code to a new project try to compile it throws errors on most lines.

Here is some of the main.c in case this helps:

interrupt[TIMERA0_VECTOR] void Timer_A(void){
    Tb++;
    Ta++;
    HSF = (~HSF)&0x01;
    if(Tb >= 30){
        Tb = 0;
        P2OUT &= 0x7f;
    }
    if(Ta >= 120){
        Ta = 0;
        close_meter();
    }
}

interrupt[PORT2_VECTOR] void poweroff(void){
    P2IFG = 0x00;
    CCTL0 |= CCIE;
    LPM3_EXIT;
}
void main(void){
    int i;
    WDTCTL = WDTPW + WDTHOLD;
    FLL_CTL0 = XCAP14PF;
    SCFQCTL = 0x3f;
    SCFI0 = FN_2 | FLLD_4;
    FLL_CTL0 |= DCOPLUS;
    TACTL = TASSEL0 + TACLR + MC0;
    CCR0 = 16384;
    CCTL0 = CCIE;
    _EINT();

I apologize if I am not asking the right questions, I normally do hardware.

Hatman
  • 161
  • 1
  • 8
  • The code sample is clearly using a bunch of extensions to standard C (the `interrupt[XYZ_VECTOR]` annotations, for instance). You will need to identify exactly which compiler was used before you can do anything with it. There's a good chance you need not only a specific compiler and IDE, but a specific *version* of that compiler and IDE. Unfortunately I do not recognize this environment myself. – zwol May 13 '19 at 15:10
  • 2
    What exactly do you asking here? What was used to create the project? Likely the IAR Embedded Workbench. Probably one of the older versions. – Eugene Sh. May 13 '19 at 15:11
  • the posted code snippet is not nearly enough information. However, You will have to setup the necessary development environment. This includes all the libraries, all the header files, the compiler, the linker, the makefile, and make utility, etc that are needed in the development environment. – user3629249 May 13 '19 at 15:16
  • The last time I worked with the MSP430, I used CodeWrit, which the code sample definately was not written for, as that environment required writing a separate file for the interrupt vectors. – user3629249 May 13 '19 at 15:18
  • 1
    [Here](http://ftp.iar.se/WWWfiles/msp430/webic/doc/EW430_IDEGuide.pdf) on page 171 listed different file types used by EWB. `dtp` is not there, but the others are. – Eugene Sh. May 13 '19 at 15:19
  • I assumed the dtp or prj was the files i needed to open a workspace in which i could set all that up and i just needed a specific environment to open it. Should i just make a new workspace in IAR and set all that up? – Hatman May 13 '19 at 15:20
  • @EugeneSh.ah thanks, i see prj is an old project format for IAR. i'll look into seeing how to open that – Hatman May 13 '19 at 15:22
  • You can try it. There is still a chance that the syntax for the language extensions have changed between the versions. – Eugene Sh. May 13 '19 at 15:22
  • 1
    Hmm, I seem to recall when I worked with MSP430 through IAR, interrupt vectors were denoted with `#pragma vector` or something like that. That was a few years ago, though. – Christian Gibbons May 13 '19 at 15:23
  • The development environment for a specific project only has the project file, the local header files, the local C source files, and the makefile. The rest of the needed files are all related to the tools needed/will be used by you – user3629249 May 13 '19 at 15:24
  • 1
    @ChristianGibbons I saw the syntax as in the question somewhere, but can't recall where.. :( But I happened to work with some really old IAR (Hitachi then) workbench, so it could be it. – Eugene Sh. May 13 '19 at 15:24
  • @EugeneSh. I remember seeing different syntax than the `#pragma vector` syntax when I started looking into working in Code Composer. I'm not sure I ever dealt with interrupts when I used `mspgcc`, but I imagine that wouldn't use the pragma syntax. – Christian Gibbons May 13 '19 at 15:26
  • 1
    @ChristianGibbons That would use `__attribute__` https://stackoverflow.com/questions/15500826/how-to-declare-an-interrupt-handler-isr-in-mspgcc – Eugene Sh. May 13 '19 at 15:29
  • Do you have the documentation for the MSP430? Including the data sheet, the built-in peripherals document, etc? do you have the libraries, header files, etc from TI? – user3629249 May 13 '19 at 15:30
  • Given the age of the MSP430, I would expect the CodeComposer IDE (from TI) would be the right thing to use. – user3629249 May 13 '19 at 15:33
  • @EugeneSh. thanks for the tips, i used a new workspace and just pasted in my code, turns out the mass amount of errors has so far been because of very old syntax. i'm replacing it all with the new terms and the errors are falling away rapidly – Hatman May 13 '19 at 16:51

1 Answers1

3

Copy/pasting the code to a new workspace in IAR worked. To get rid of all the errors, I just had to update the outdated syntax of my interrupts from

interrupt[TIMERA0_VECTOR] void Timer_A(void){

and

interrupt[PORT2_VECTOR] void poweroff(void){

to

#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer_A(){

and

#pragma vector = PORT2_VECTOR
__interrupt void poweroff(void){

Thank you to @Eugene Sh. and @Christian Gibbons for the conversation about how the interrupt syntax looked old and questionable which put me on the right track.

Hatman
  • 161
  • 1
  • 8