Building CLawson's SD bootloader in 6.1

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

Hi All...

I have been trying to build Cliff's SD bootloader and am running into a simple problem. Studio 6.1 can't find srec_cat when it tried to execute it. I'm running on Windows 7 64bit.

What's the proper fix? Should I modify the PATH to point to it, or is there a setting in 6.1 I need to throw?

I'll paste the complaint below, thanks!

------ Build started: Project: avrapp, Configuration: Debug AVR ------
Build started.
Project "avrapp.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.1\Vs\Compiler.targets" from project "C:\Users\jim\Documents\RP4N_Stuff\bootloaders\AVR SD Bootloader by Cliff Lawson\Project\avrapp\avrapp.cproj" (target "Build" depends on it):
	Task "RunCompilerTask"
		C:\Program Files (x86)\Atmel\Atmel Studio 6.1\shellUtils\make.exe all 
		Building file: ../../uart/uart.c
		Invoking: AVR/GNU C Compiler : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe"  -funsigned-char -funsigned-bitfields -DF_CPU=3686400UL  -I"../../uart"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega16 -c -std=gnu99 -MD -MP -MF "uart.d" -MT"uart.d" -MT"uart.o"   -o "uart.o" "../../uart/uart.c"
		Finished building: ../../uart/uart.c
		Building file: .././avrapp.c
		Invoking: AVR/GNU C Compiler : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe"  -funsigned-char -funsigned-bitfields -DF_CPU=3686400UL  -I"../../uart"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega16 -c -std=gnu99 -MD -MP -MF "avrapp.d" -MT"avrapp.d" -MT"avrapp.o"   -o "avrapp.o" ".././avrapp.c"
		Finished building: .././avrapp.c
		Building target: avrapp.elf
		Invoking: AVR/GNU Linker : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe" -o avrapp.elf  uart.o avrapp.o   -Wl,-Map="avrapp.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -mmcu=atmega16 
		Finished building target: avrapp.elf
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature  "avrapp.elf" "avrapp.hex"
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom  --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0  --no-change-warnings -O ihex "avrapp.elf" "avrapp.eep" || exit 0
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "avrapp.elf" > "avrapp.lss"
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature  "avrapp.elf" "avrapp.srec"
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-size.exe" "avrapp.elf"
		   text	   data	    bss	    dec	    hex	filename
		    324	      0	      0	    324	    144	avrapp.elf
	Done executing task "RunCompilerTask".
	Task "RunOutputFileVerifyTask"
				Program Memory Usage 	:	324 bytes   2.0 % Full
				Data Memory Usage 		:	0 bytes   0.0 % Full
	Done executing task "RunOutputFileVerifyTask".
Done building target "CoreBuild" in project "avrapp.cproj".
Target "PostBuildEvent" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.1\Vs\Avr.common.targets" from project "C:\Users\jim\Documents\RP4N_Stuff\bootloaders\AVR SD Bootloader by Cliff Lawson\Project\avrapp\avrapp.cproj" (target "Build" depends on it):
	Task "Exec"
		Command:
		srec_cat C:\Users\jim\Documents\RP4N_Stuff\bootloaders\AVR SD Bootloader by Cliff Lawson\Project\avrapp\Debug\avrapp.hex -intel -fill 0xFF 0x0000 0x6FFE --l-e-crc16 0x6FFE -o foo.bin -binary
		'srec_cat' is not recognized as an internal or external command,
		operable program or batch file.
C:\Program Files (x86)\Atmel\Atmel Studio 6.1\Vs\Avr.common.targets(36,5): MSB3073: The command "srec_cat C:\Users\jim\Documents\RP4N_Stuff\bootloaders\AVR SD Bootloader by Cliff Lawson\Project\avrapp\Debug\avrapp.hex -intel -fill 0xFF 0x0000 0x6FFE --l-e-crc16 0x6FFE -o foo.bin -binary" exited with code 9009.
	Done executing task "Exec" -- FAILED.
Done building target "PostBuildEvent" in project "avrapp.cproj" -- FAILED.
Done building project "avrapp.cproj" -- FAILED.

Build FAILED.
------ Build started: Project: pfboot, Configuration: Debug AVR ------
Build started.
Project "pfboot.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.1\Vs\Compiler.targets" from project "C:\Users\jim\Documents\RP4N_Stuff\bootloaders\AVR SD Bootloader by Cliff Lawson\Project\pfboot.cproj" (target "Build" depends on it):
	Task "RunCompilerTask"
		C:\Program Files (x86)\Atmel\Atmel Studio 6.1\shellUtils\make.exe all 
		Building file: .././asmfunc.S
		Invoking: AVR32/GNU Assembler : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe" -Wa,-gdwarf2 -x assembler-with-cpp -c -mmcu=atmega32 -DF_CPU=3686400 -MD -MP -MF "asmfunc.d" -MT"asmfunc.d" -MT"asmfunc.o" -Wa,-g   -o "asmfunc.o" ".././asmfunc.S"
		Finished building: .././asmfunc.S
		Building file: .././main.c
		Invoking: AVR/GNU C Compiler : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe"  -funsigned-char -funsigned-bitfields -DBOOT_ADR=0x7000 -DF_CPU=3686400UL -DCODE_LEN=BOOT_ADR-2  -I"../uart"  -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega32 -c -std=gnu99 --save-temps -fverbose-asm -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c"
		Finished building: .././main.c
		Building file: .././mmc.c
		Invoking: AVR/GNU C Compiler : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe"  -funsigned-char -funsigned-bitfields -DBOOT_ADR=0x7000 -DF_CPU=3686400UL -DCODE_LEN=BOOT_ADR-2  -I"../uart"  -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega32 -c -std=gnu99 --save-temps -fverbose-asm -MD -MP -MF "mmc.d" -MT"mmc.d" -MT"mmc.o"   -o "mmc.o" ".././mmc.c"
		Finished building: .././mmc.c
		Building file: ../uart/uart.c
		Invoking: AVR/GNU C Compiler : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe"  -funsigned-char -funsigned-bitfields -DBOOT_ADR=0x7000 -DF_CPU=3686400UL -DCODE_LEN=BOOT_ADR-2  -I"../uart"  -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -Wall -mmcu=atmega32 -c -std=gnu99 --save-temps -fverbose-asm -MD -MP -MF "uart.d" -MT"uart.d" -MT"uart.o"   -o "uart.o" "../uart/uart.c"
		Finished building: ../uart/uart.c
		Building target: pfboot.elf
		Invoking: AVR/GNU Linker : 3.4.2
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-gcc.exe" -o pfboot.elf  asmfunc.o main.o mmc.o uart.o   -Wl,-Map="pfboot.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections -Wl,-section-start=.text=0x7000  -mmcu=atmega32 -nostartfiles -Wl,-relax 
		Finished building target: pfboot.elf
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature  "pfboot.elf" "pfboot.hex"
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom  --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0  --no-change-warnings -O ihex "pfboot.elf" "pfboot.eep" || exit 0
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "pfboot.elf" > "pfboot.lss"
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature  "pfboot.elf" "pfboot.srec"
		"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.1002\avr8-gnu-toolchain\bin\avr-size.exe" "pfboot.elf"
		   text	   data	    bss	    dec	    hex	filename
		   2490	      0	    513	   3003	    bbb	pfboot.elf
	Done executing task "RunCompilerTask".
	Task "RunOutputFileVerifyTask"
				Program Memory Usage 	:	2490 bytes   7.6 % Full
				Data Memory Usage 		:	513 bytes   25.0 % Full
	Done executing task "RunOutputFileVerifyTask".
Done building target "CoreBuild" in project "pfboot.cproj".
Target "PostBuildEvent" in file "C:\Program Files (x86)\Atmel\Atmel Studio 6.1\Vs\Avr.common.targets" from project "C:\Users\jim\Documents\RP4N_Stuff\bootloaders\AVR SD Bootloader by Cliff Lawson\Project\pfboot.cproj" (target "Build" depends on it):
	Task "Exec"
		Command:
		rem if these cause an error just rem them or get my avr-source program
avr-source main.s
rem avr-source mmc.s
rem avr-source uart.s
		'avr-source' is not recognized as an internal or external command,
		operable program or batch file.
C:\Program Files (x86)\Atmel\Atmel Studio 6.1\Vs\Avr.common.targets(36,5): MSB3073: The command "rem if these cause an error just rem them or get my avr-source program
avr-source main.s
rem avr-source mmc.s
rem avr-source uart.s" exited with code 9009.
	Done executing task "Exec" -- FAILED.
Done building target "PostBuildEvent" in project "pfboot.cproj" -- FAILED.
Done building project "pfboot.cproj" -- FAILED.

Build FAILED.
========== Build: 0 succeeded or up-to-date, 2 failed, 0 skipped ==========
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The only fault I can see there is that you don't appear to have a copy of srec_cat installed. Suggest you just get a copy of WinAVR and install that then make sure the srec_cat.exe from it is somewhere in your PATH.

It also invokes my avr-source program:

http://spaces.atmel.com/gf/proje...

You don't seem to have that installed either. Just get a copy from that site at:

http://spaces.atmel.com/gf/downl...

Or do as the comment says:

      rem if these cause an error just rem them or get my avr-source program
avr-source main.s
rem avr-source mmc.s
rem avr-source uart.s 

That is added "rem" to the first just as with the other two.

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

Thanks Cliff...

I have winavr installed, along with srec_cat, I just didn't know if studio 6.1 was supposed to come with it or if I was supposed to supply it. I'll add it to my path.

I just read about your source program, looks pretty cool. I'll grab and install that, thanks.

As to the remarking out stuff, I did see the comment, but I confess, I could not figure out where that stuff was so I could rem it out. I have never used studio for a development project, just to program boards.

Thanks again.

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

For the record. In the Project Properties there is a tab called "Build Events". See below...

Attachment(s): 

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

Yea, I got it to build! I also had to remove the spaces in the folder names leading to the project.

Now the fun part - making it work with my board!

Thanks again Cliff, and thanks for the bootloader too!

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

Where is the proper place to define F_CPU ??? I see the makefile is generated, and I can't seem to find a place in the project settings to create macros. Should I do it in a source file?

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

Quote:

I can't seem to find a place in the project settings to create macros

Project properties, Toolchain tab, AVR/GNU C Compiler, Symbols.

http://www.atmel.no/webdoc/atmel...

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Ah, thanks... But I see F_CPU is already defined there, yet I still get:

Warning	1	#warning "F_CPU not defined for " [-Wcpp]

Which is generated by this code in util/delay.h:

#ifndef F_CPU
/* prevent compiler error by supplying a default */
# warning "F_CPU not defined for "
# define F_CPU 1000000UL
#endif

So is that macro definition not global for the entire project?

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

Oh I see, apparently delay.h is part of a different project (the avrapp sample program) but the pfboot project builds pfboot and avrapp. In the configuration for avrapp F_CPU is not defined...

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

For the record this is what the three -D setting screens look like as you pull the project from SVN. I have all set to 3.6864MHz as that's what the clock on STK500 was providing for my test.

F_CPU is defined in three places - once for "avrapp" which is just a test program that says "hello" from the UART. It is defined twice for the actual bootloader (pfboot). This, IMHO, is a nasty "gotcha" in AS6. You have to define the same thing separately for Asm as for C. Whatever happened to the AS4 days where there was a separate, obvious box to define this and it applied everywhere??

Attachment(s): 

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

Quote:

Whatever happened to the AS4 days where there was a separate, obvious box to define this and it applied everywhere??

One thing that happened was the introduction of the Solution concept. In AS4 you only had projects. In both AS4 and AS6 you have to do a define once per project. So the comparison is not really fair all the way.

Having to do it once for C source files and once for GNU Assembler even if the C and asm files are within the same project sucks though. It should be once per project.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Quote:

So the comparison is not really fair all the way.

Yes it is. Every "project" should have a single "put the CPU speed here" box and it should pass -D's for F_CPU to everything in that project that might be interested in hearing about it. Sure there's a higher level - I don't expect there to be a "solution wide" setting but as 99% of people will have one project in one solution then having it apply right across a project would work for most.

My solution here is a bit unusual in that there are two projects. Sure this would mean each would need it set separately and I accept that. What I object to is that fact that Asm and C in the SAME PROJECT each need to have it set separately. Also the fact that it's now up to the user to know the -DF_CPU=nnnnUL syntax. In AS4 they simply edited nnnn into a text edit and the IDE did the rest. That's what IDEs are supposed to do for you - present complex command line definitions as simple edits (tick boxes, radio buttons, droplists and text edits).

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

Quote:

I don't expect there to be a "solution wide" setting

That was how I interpreted you, and that was the unfair bit.

Per Solution: No. That would be stupid. Different projects within a solution could be destined for different "systems" with different F_CPUs.

Per GCC Project: Naturally. Regardless of if it is C only, assembler only, or a mix it will be destined for one "system" with one F_CPU.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Where can I find Cliff's SD bootloader? Neither Google nor the avrfreaks site search could locate it for me. :(

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

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Most curious. I just typed nothing more than "sd bootloader" into Google and my project was the third link. Did you not see the same when you googled?

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

Thing is that nothing on the Spaces project page says that it is "Cliff's SD bootloader". You also appear on Spaces under another username than here of 'freaks.

Yes, there is a clue in the username "Wilbur Orville Wright" if one knows about your #1 passion, and your alternate username here at 'freaks.

Without that I guess there is little hinting at the Spaces project being started by you.

Perhaps add some good keywords to the "front page" of the Spaces project?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

I was confused when I first found it also, and for a while I was not sure it was the right one.

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

If I had my way I'd be "Wright Flyer" here too but when I signed up in 2005 it was to ask a professional question so I used my "professional" ID. The rest if history.