AS 6.2 unable to program working old code

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I have some fully functional old code, that I have programmed into chip many times, but now I cannot tweak/ change this code and program into a chip.  

 

I can compile the code, read from the chip, but if I change for example print(fred) to print(harry) it continues printing fred.  Also if I change an led flash speed, nothing changes when the chip is programmed.  The program file does not update somehow.

 

I have changed nothing with AS 6.2, that I know of.  Can somebody outline what files I should check to confirm if the program files are updating.  Or can AS 6.2 lose its settings?

 

The .c files update in the project folder, but these changes are not programmed to the chip.

 

thanks,

 

Tuurbo46

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds like the code doesn't build - what does the build log say?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
	Done executing task "RunOutputFileVerifyTask".
Done building target "CoreBuild" in project "GM.cproj".
Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').
Target "Build" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.2\Vs\Avr.common.targets" from project "C:\Documents\GM\GM.cproj" (entry point):
Done building target "Build" in project "GM.cproj".
Done building project "GM.cproj".

Build succeeded.
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Should I try starting a new project and copying all files across.

 

As I said I have changed nothing?

 

thanks,

 

Tuurbo46

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just make some deliberate edit to the file containing the print() and then rebuild and show build output (in the above nothing was effectively done because the build system thought everything was built up to date).

 

Also post the .hex file. You should be able to do this:

$ cat avr.hex
:100000000C942A000C9447000C9447000C94470071
:100010000C9447000C9447000C9447000C94470044
:100020000C9447000C9447000C9447000C94470034
:100030000C9447000C9447000C9447000C94470024
:100040000C9447000C9447000C9447000C94470014
:100050000C94470011241FBECFE5D4E0DEBFCDBF16
:1000600010E0A0E6B0E0E4E4F1E002C005900D92FB
:10007000A636B107D9F710E0A6E6B0E001C01D92A0
:10008000AC36B107E1F70E9449000C94A0000C9433
:10009000000080E690E00E94500080E090E008952B
:1000A000EF92FF920F931F93CF93DF938C01E09118
:1000B0006800F0916900838181FF1FC0C0E0D0E03B
:1000C0000AC0DB011896ED91FC91199709950097EC
:1000D00011F0CFEFDFEFF80181918F01609168009F
:1000E00070916900882369F7DB011896ED91FC9106
:1000F00019978AE00995009711F0CFEFDFEFCE0155
:10010000CDB7DEB7E6E00C9491002A88398848889C
:100110005F846E847D848C849B84AA84B984C88423
:10012000DF80EE80FD800C811B81AA81B981CE0F1A
:10013000D11D0FB6F894DEBF0FBECDBFED010895FF
:04014000F894FFCF61
:060144006861727279008F
:00000001FF
$ avr-objcopy -I ihex -O binary avr.hex avr.bin
$ hexdump -C avr.bin
00000000  0c 94 2a 00 0c 94 47 00  0c 94 47 00 0c 94 47 00  |..*...G...G...G.|
00000010  0c 94 47 00 0c 94 47 00  0c 94 47 00 0c 94 47 00  |..G...G...G...G.|
*
00000050  0c 94 47 00 11 24 1f be  cf e5 d4 e0 de bf cd bf  |..G..$..........|
00000060  10 e0 a0 e6 b0 e0 e4 e4  f1 e0 02 c0 05 90 0d 92  |................|
00000070  a6 36 b1 07 d9 f7 10 e0  a6 e6 b0 e0 01 c0 1d 92  |.6..............|
00000080  ac 36 b1 07 e1 f7 0e 94  49 00 0c 94 a0 00 0c 94  |.6......I.......|
00000090  00 00 80 e6 90 e0 0e 94  50 00 80 e0 90 e0 08 95  |........P.......|
000000a0  ef 92 ff 92 0f 93 1f 93  cf 93 df 93 8c 01 e0 91  |................|
000000b0  68 00 f0 91 69 00 83 81  81 ff 1f c0 c0 e0 d0 e0  |h...i...........|
000000c0  0a c0 db 01 18 96 ed 91  fc 91 19 97 09 95 00 97  |................|
000000d0  11 f0 cf ef df ef f8 01  81 91 8f 01 60 91 68 00  |............`.h.|
000000e0  70 91 69 00 88 23 69 f7  db 01 18 96 ed 91 fc 91  |p.i..#i.........|
000000f0  19 97 8a e0 09 95 00 97  11 f0 cf ef df ef ce 01  |................|
00000100  cd b7 de b7 e6 e0 0c 94  91 00 2a 88 39 88 48 88  |..........*.9.H.|
00000110  5f 84 6e 84 7d 84 8c 84  9b 84 aa 84 b9 84 c8 84  |_.n.}...........|
00000120  df 80 ee 80 fd 80 0c 81  1b 81 aa 81 b9 81 ce 0f  |................|
00000130  d1 1d 0f b6 f8 94 de bf  0f be cd bf ed 01 08 95  |................|
00000140  f8 94 ff cf 68 61 72 72  79 00                    |....harry.|
0000014a

As you can see I have created an AVR program here that contains the name "harry" and I can see it. You should be able to check your generated .hex file in the same way to see if it contains "fred" or "harry".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hear is a brief example, hex file and source code included below:

 

My hex file does not look like your file.  Did you copy in more files?

100000000C943E000C9453000C9453000C94530039
:100010000C9453000C9453000C9453000C94530014
:100020000C9453000C9453000C9453000C94530004
:100030000C9453000C9453000C9453000C945300F4
:100040000C9453000C9453000C9453000C945300E4
:100050000C9453000C9453000C9453000C945300D4
:100060000C9453000C9453000C9453000C945300C4
:100070000C9453000C9453000C94530011241FBE95
:10008000CFEFD8E0DEBFCDBF11E0A0E0B1E0E2EC01
:10009000F0E002C005900D92A630B107D9F70E949A
:1000A00055000C945F000C94000080E091E00E94E9
:1000B0005A00FBCFFC0180818111FFCF0895F89495
:0200C000FFCF70
:0600C20068617272790012
:00000001FF


#include <avr/io.h>
#include "usart.h"

uint8_t harry[6] = "harry";

int main(void)
{
    while(1)
    {
		write_usart_0(harry); // print harry
    }
}

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also check the location of the file you are uploading via the tool.  It could be you are pointing at the old file not the one you just created. 

 

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your hex file contains:

$ hexdump -C avr.bin
00000000  0c 94 3e 00 0c 94 53 00  0c 94 53 00 0c 94 53 00  |..>...S...S...S.|
00000010  0c 94 53 00 0c 94 53 00  0c 94 53 00 0c 94 53 00  |..S...S...S...S.|
*
00000070  0c 94 53 00 0c 94 53 00  0c 94 53 00 11 24 1f be  |..S...S...S..$..|
00000080  cf ef d8 e0 de bf cd bf  11 e0 a0 e0 b1 e0 e2 ec  |................|
00000090  f0 e0 02 c0 05 90 0d 92  a6 30 b1 07 d9 f7 0e 94  |.........0......|
000000a0  55 00 0c 94 5f 00 0c 94  00 00 80 e0 91 e0 0e 94  |U..._...........|
000000b0  5a 00 fb cf fc 01 80 81  81 11 ff cf 08 95 f8 94  |Z...............|
000000c0  ff cf 68 61 72 72 79 00                           |..harry.|
000000c8

so it is the "harry" version that's been built.

 

I'm with David - the programming dialog is probably selecting an old, out of date hex file (if so you are only the 10 gazillionth person to be caught by this!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

Thanks for your input.

 

The programmer, when you select "Apply",  then "Read" back device signature, then "Memories" is pointing to C:\Users\Documents\Test\Test\Test\Debug\Test.elf     and Test.elf has the latest build time.  Is there somewhere else I should change, to change the file it points at?

 

 

Also in C:\Users\Documents\Test\Test\Test\Debug\Test.hex     the only data in this file is below, how did you generate your output clawson?

 

:100000000C943E000C9453000C9453000C94530039
:100010000C9453000C9453000C9453000C94530014
:100020000C9453000C9453000C9453000C94530004
:100030000C9453000C9453000C9453000C945300F4
:100040000C9453000C9453000C9453000C945300E4
:100050000C9453000C9453000C9453000C945300D4
:100060000C9453000C9453000C9453000C945300C4
:100070000C9453000C9453000C94530011241FBE95
:10008000CFEFD8E0DEBFCDBF11E0A0E0B1E0E2EC01
:10009000F0E002C005900D92A630B107D9F70E949A
:1000A00055000C945F000C94000080E091E00E94E9
:1000B0005A00FBCFFC0180818111FFCF0895F89495
:0200C000FFCF70
:0600C20066726564000097
:00000001FF

 

I was also wondering if windows update, has changed a setting, when downloading a Visual Studio update?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tuurbo46 wrote:
how did you generate your output clawson?
I deliberately posted that in a pst above - did you miss it? The bottom line is that you can use avr-objcopy to do file conversions. What you want (to make it more easily viewable) is to convert the .hex to binary. You do that using "-I ihex -O binary" which means "the input format is intel hex, the output should be raw binary". So I just put your hex data into a file:

~$ cat avr.hex
:100000000C943E000C9453000C9453000C94530039
:100010000C9453000C9453000C9453000C94530014
:100020000C9453000C9453000C9453000C94530004
:100030000C9453000C9453000C9453000C945300F4
:100040000C9453000C9453000C9453000C945300E4
:100050000C9453000C9453000C9453000C945300D4
:100060000C9453000C9453000C9453000C945300C4
:100070000C9453000C9453000C94530011241FBE95
:10008000CFEFD8E0DEBFCDBF11E0A0E0B1E0E2EC01
:10009000F0E002C005900D92A630B107D9F70E949A
:1000A00055000C945F000C94000080E091E00E94E9
:1000B0005A00FBCFFC0180818111FFCF0895F89495
:0200C000FFCF70
:0600C20066726564000097
:00000001FF

then I issue the objcopy command that says read that and write it out to a .bin file:

$ avr-objcopy -O binary -I ihex avr.hex avr.bin
$ 

then I just use a standard Linux command to show me what the .hex contains:

$ hexdump -C avr.bin
00000000  0c 94 3e 00 0c 94 53 00  0c 94 53 00 0c 94 53 00  |..>...S...S...S.|
00000010  0c 94 53 00 0c 94 53 00  0c 94 53 00 0c 94 53 00  |..S...S...S...S.|
*
00000070  0c 94 53 00 0c 94 53 00  0c 94 53 00 11 24 1f be  |..S...S...S..$..|
00000080  cf ef d8 e0 de bf cd bf  11 e0 a0 e0 b1 e0 e2 ec  |................|
00000090  f0 e0 02 c0 05 90 0d 92  a6 30 b1 07 d9 f7 0e 94  |.........0......|
000000a0  55 00 0c 94 5f 00 0c 94  00 00 80 e0 91 e0 0e 94  |U..._...........|
000000b0  5a 00 fb cf fc 01 80 81  81 11 ff cf 08 95 f8 94  |Z...............|
000000c0  ff cf 66 72 65 64 00 00                           |..fred..|
000000c8

So your most recently posted version is a "fred" one.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK thanks clawson for your explanation.

 

So the build hex file is correct,  the programming path is correct, and the programming ribbon tests ok with a meter.  So the last item is my ICE....but I can read device signature correctly, so it points to this being correct.

 

Do you have any ideas of what else could be wrong?

 

Many thanks.

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would delete any Debug/Release folders and temp folders. Force Studio to re-build the entire solution (Build->Rebuild Solution, if it's the same VS, don't have Atmel Studio in front of me).

 

Also...

Tuurbo46 wrote:
C:\Users\Documents\Test\Test\Test\Debug\Test.elf

Guess you can never have enough tests... Haha!

My digital portfolio: www.jamisonjerving.com

My game company: www.polygonbyte.com