This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

generate a file in IAR



hello,

i trying to generate a text file with IAR in desktop for example, is it possible?

i tried this:

#include <map430x14x.h>
#include <stdio.h>
#include <stdlib.h>
void main(void) {
   FILE *datei;
   /* Bitte Pfad und Dateinamen anpassen */
   datei = fopen("C:\\Users\\Arthur\\Desktop\\test.txt", "w");
    fprintf(datei,"hallo");
}

i got no error only if i choose full DLIB. i tried first "simulator".

then i got this error :

Fatal Error[e89]: Too much object code produced (more than 0x1000 bytes) for this package .

 

can anybody help ?

 

Thanks

 

  • Hi Arthur,

    I'm sorry, but I don't understand your question! What do you want to do with the .txt file?

    What do you want do do?

    A 'New project guide' for IAR is in the MWP430 wiki. You can find it here http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/p/19537/76134.aspx#76134

    Rgds
    aBUGSworstnightmare

  • hello aBUGSworstnightmare,

    I am working on a Projekt for testing the RAM of the MSP430. in my Code i have for example a funktion that writes 0xAAAA in the whole RAM, so and then ir read the RAM one Adress after the other and compare it with 0xAAAA. if its not 0xAAAA, so it was a write error, and i want to print it in text-file on my PC.

    but i Have Problems using funktions like fopen, fclose, fprintf......

    the text file should contain all the errors occured. assume nor there was error on adress 0x0200 and 0x300.

    the text file should lokk like this:

    .

    .

    Error at 0x0200     expected 0xAAAA    read  0x0000

    Error at 0x0300     expected 0xAAAA    read  0x1111

    ect.


    i hope you understtand now my problem

    regards

    Arthur


  • Arthur said:
    i trying to generate a text file with IAR in desktop for example, is it possible?

    No. The code you compile goes into the (real or simulated) MSP. And this MSP has no access to your PCs harddisk.

    Arthur said:
    FILE *datei;

    This stuff would, if supported, open a file on a storage device attached to the MSP. The handling of this device (SD card, IDE harddisk etc.) would be 100% under the control of the MSP. All code needed for file system, accessign the device hardware etc. ned to be on the MSP and executed by the MSP.

    This also explains the error message:

    Arthur said:
    Too much object code produced (more than 0x1000 bytes) for this package .

    The compiler you use is limited to 4k code size. And the fprintf library functions and the file access code (not to mention all the stuff necessary for really accessing a storage hardware and provide a file system) is MUCH larger than that.

    Remember, on teh MSP, there is no OS which you can call for the high-level work. YOU are writing the OS that runs on the MSP. There's nothing except what you write. Like a PC without Windows/Linux, even without BIOS.

    Arthur said:
    i got no error only if i choose full DLIB. i tried first "simulator".

    If the compiler/linker wouldn't complain about the code size, you'd probably get lots of linker errors about missing functions. TH elinker stops while still collection all that's there and included, long before it can sort things out and detect that there is even more needed but not there.

     

     

  • Hello Jens-Michael,

    I thinks i have the same problem, i want to stock the data random from TX in a txt file. I wrote a code :

    FILE* fichier = NULL;
        fichier=fopen("test.txt", "w");
       
        if (fichier !=NULL)
        {  
        for (n=0; n < sizeof(txPacket.padding); n++)
        {
          txPacket.padding[n] = rand();
          fprintf (fichier,"%s", txPacket.padding[n]);
        }
        fclose(fichier);
        }

    So, you said that IAR can't acces to a file txt. How do to do if i want this file please ? i have an error with BANKED_CODE !!!

    Fatal Error[e72]: Segment BANKED_CODE must be defined in a segment definition option (-Z, -b or -P)

  • MilkyWay 05 said:
    So, you said that IAR can't acces to a file txt.

    IAR itself can, however, whatever you compile with IAR is meant to run on the MSP (simulated or not) and not on the PC. And the MSP has no access to your PCs harddisk. All communication goes to the existing interfaces (simulated or real) which are UART, SPI, I2C or GPIO.
    The MSP itself does not contain any operating system at all, so all you can do on it is what you program into it. And there is no file system too which would handle your file access code, even if you get it to compile. You'll have to include a library that provides the code, then you'll have to interface teh storage device somehow (e.g. attaching an IDE drive to the MSP port pins or attach an SD card to it.

    Which is a LOT of code and likely too much for the smaller MSPs (and definitely too much for the free IAR and CCS versions).

    So what you want to do is to send the data to the PC (using a serial port) and capture it there into a file (by a PC program).

    MilkyWay 05 said:
    Fatal Error[e72]: Segment BANKED_CODE must be defined in a segment definition option (-Z, -b or -P)

    Looks like you tried to use code that was written for a different processor or at least for an OS, that works on banked code. The default linker definition files do not know about banked code. There is no banked code in standard MSP environment. All code fits into the MSP or it is too large.
    Systems that load code dynamically from an external storage are 'special', and there should be a special documentation. And they are usually optimized for a certain compiler.

     

**Attention** This is a public forum