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.

Where do the programs go and what do they look like?



Hi all,

I have a quick question that I've been wondering. I use IAR work bench to write C code that gets compiled to the machine instructions understood by the ARM Cortex M MCU on my TM4.

What I want to know is at some stage the machine instructions which I see as hex codes  in the debugger  within the disassembly view get converted to 1's and 0's by the assembler right? So when they get downloaded to the TM4C board - what memory does it go into? the 256K Ram? EEPROM? Which part of the memory?

I understand the RAM to be nothing more than an organised table of bytes which are just numbers in memory represented in binary so once compiled and downloaded the "download" process throws the assembly code into the memory as 1's and 0's right?

Is there a more elegant explanation of this process? It does intrigue me. Obviously because the TM4C has no operating system the device just has the one program we write sitting in the memory of the device which gets executed when it's turned on.

Like what I want to know as well is when we hit the download button to put our compiled / assembled code into the memory of the device is this a "file" or does it literally write the 1's and 0's to the memory in "real time" so to speak?

Sorry for all the questions but a good explanation of this to me would really satisfy my intrigue as to how this works. 

How a .exe file in windows actuall works baffles me because there's the OS as well which makes it all that little more complicated. What's the key difference between say a .exe file in windows being loaded into memory as 1's and 0's compared to our simple TM4C with no OS? Is an exe file literally 1's and 0's? 

  • Hello James,

    Where the code will be placed depends upon the linker cmd file or scatter file. It can reside either on SRAM or in Flash. The SRAM is a Volatile memory so after a power cycle the content will be lost unlike Flash which will retain it. The EEPROM is also NVM but for TM4C it is not a executable memory.
    The download button actually takes the address and data at the address and programs the memory. There are more than that which happens but in simple terms, download takes a machine code and puts it into the executable memory space of a device and resets the CPU to begin executing.

    Regards
    Amit
  • Thank you so much very helpful!
  • Hi Amit,

    hijack time:

    So is there already a ready cmd file to load the program into the RAM? And I just need to change the cmd file? Or I need to edit somewhere the address that the linker starts write on?
    I kinda wanted to program the Tiva like the C2000 (when programming to the RAM). To avoid wearing out the flash - I think it's a good idea when I am making some very simple tests or teaching something to colleagues, which normally means a lot of erasing/writing the code into the Tiva.
  • Hello Luis,

    You can change the cmd file for all FLASH section to be in SRAM. The Flash has a 50K endurance cycle, so it would be a long time before you would see any affects.

    Regards
    Amit
  • Thank you Amit

    I know this is different, but I remember having lots of Picaxes (a PIC16 with bootloader) having that problem in the next school year of their purchase. So I am a bit paranoid with that now :p

  • On multiple ARM MCUs - this vendor & others - we have far exceeded the (conservative) 50K (minimum) safe flash transactions. (some of our testing exceeded 75K flash transactions) Never/ever did we note subsequent flash issues - neither error creepage nor slowed downloads.

    Comparing a "tired/outdated" technology to ARM may not make great sense. It is one reason you've migrated - is it not?

  • Hi Luis, thank for one hint, not sure can be of real help but on TM4C129 series, E series are not for all and 123 series has no EPI, one can run program on external ram too, by managing separating ram code from ram data an access analysis can be done to profile both code and data area.

    This is also done by software through JTAG at expense of real time, this solution coupled with a logic analyser or a SRAM/SDRAM served by an FPGA can do the trick @ near real time...

    New light over the old unpaved road ...

  • As regards, "wearing out" of 50K flash-life devices - if programmed 10 times/day - back of (soiled) napkin reveals 13.7 years of usage - prior to arrival of "fateful" event # 50K.

    You may wish to worry about another issue/dragon....
  • cb1- said:
    As regards, "wearing out" of 50K flash-life devices - if programmed 10 times/day - back of (soiled) napkin reveals 13.7 years of usage - prior to arrival of "fateful" event # 50K.

     Yes CB1, but I am not worried about wearing nor time to unusable silicon... I was planning use external relocation to enable near real time profiling of code, when on flash jtag proffilation run slowly.

    cb1- said:
    You may wish to worry about another issue/dragon....

     NRND is this dragon? Yes this one scare me a lot...

  • Roberto Romano said:
    xxxx is this dragon? Yes this one scare me a lot...

    Roberto - earlier I credited you as, "Savant."   Yet - w/this insight - you rise to "Psychic" as well...

    "Two for the price of one" cannot be bad...

    Ciao,

  • cb1_mobile said:
    Roberto - earlier I credited you as, "Savant."   Yet - w/this insight - you rise to "Psychic" as well...

     Hi CB1, I don't know USA but the term dragon has changing meaning across the world so refer:

    http://en.wikipedia.org/wiki/Dragon

    the way is perceived is to be located firmly on where is.

     Again the term Psychic can sound good but not "savant" in European culture sound very different from USA term....

     So I have to split for antispam...

     -- to be continued on next message...

  •  second part answer...

     Savant Mon amì,

    Savant (French for "knowing", from the French savoir "to know", English since the 18th century) may refer to a worst condition of brain damage too...

    http://en.wikipedia.org/wiki/Savant_syndrome

     Sometimes I cannot grasp what you wrote due language register is forever too much high for me, I don't have knowledge on literature nor I can interpret as is and second phrase is of really difficult to figure what refer.

    cb1_mobile said:
    "Two for the price of one" cannot be bad...

     So again some usage on USA maybe different from European and I am so sure it cannot be offensive I just report as I don't understand due to my little English.

  • @Roberto,

    Both words are (reasonably) common in No. Amer. usage - yet the growing (surely good) international nature of tech forums forces a broader search - prior to usage.  

    As you surmised - I meant only the (best) usage for you (i.e. savant - one with broad/deep almost intuitive knowledge - often giving) and (i.e. dragon - a powerful force - perhaps unexpected - and of unusual size/shape/form [as you/I/others past experienced w/certain MCUs here])

    You did "decode" one good candidate meaning for dragon - I must say.   (but reluctant to use those sensitive letters, here)