Project that has both APP and BOOTLOADER

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

I noticed that AS7 has a solution level that can contain one or more projects.  Can you have a project under it that is for the application, and then a separate project under it that is for the bootloader?  I am assuming so, but each project would still be treated independently, right?

 

Is there any type of post-build event that can be added at the solution level that could combine the two?

 

Also, is there any way to combine ELF's?

 

Does everyone just hack together two HEX files, or program the bootloader and then use it to program the application code?

 

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

alank2 wrote:

Does everyone just hack together two HEX files, ...

 

Nope, I just tick the 'merge ROM file' box and specify which application file I want merged with my bootloader. But then, I am using Codevision! cheeky

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Last Edited: Thu. Oct 26, 2017 - 08:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I've worked on bootloaders I've done exactly what you are suggesting here and had one solution containing two projects for bootloader and LED flashing test app. I never bother to combine them and program as one because my belief is that bootloader code needs all the testing it can get so I always deliver the app by the bootloader process. But if I did want to make a combined.hex I would use srec_cat to do that.

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

PS forgot to say that using project dependencies you should be able to get the two projects to build in a known order. Then just add a Post Build Event to the second one to invoke srec_cat to combine the two hex files.

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

I recall that srec_cat can fill and crc16 sign a HEX file.  Can it also set bytes (or better yet multiple byte integers) into it at specific locations?

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

Read the docs - srec_cat can do about 50 different things. It has all kinds of "generators". The fact is that over the years almost everything you can think of that "wouldn't it be nice if you could do X,Y,Z to IHex or Srec?" has come up and someone has added it to srec_cat. So it'd be unusual to find something it cannot do. If this is about putting in "unique serial number" into each HEX to be programmed I am 99.9% certain that one of the generators offers this.

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

Exactly, I'd like to put a 32-bit integer (serial) into it and also a 16-bit integer (version) into it.
 

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

Isn't this deja vu all over again?

https://www.avrfreaks.net/forum/m...

https://www.avrfreaks.net/forum/h...

https://www.avrfreaks.net/forum/b...

https://www.avrfreaks.net/forum/h...

...

 

But maybe there are new facilities in e.g. Studio7.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Now I remember what I don't like about srec_cat - getting it to produce the style of crc16 I want is difficult or impossible.  I use the modbus crc and it has an -poly modbus option, but still doesn't produce the correct value.
 

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

srec_cat source is open isn't it? You could either "fix" an existing CRC generator if you think it is broken or you could add a whole new one and new command line parameter. Almost certainly quicker than writing a complete IHex manipulator yourself.

 

PS When I wanted to implement the same LE CRC 16 in my own code that srec_cat generates I knew the polynomial (from studying their code) but I could not get my own implementation to match UNTIL I finally realised that they use an "augmented CRC" so at the end of the data you have to feed two 0x00's to the generator after the actual data. When I spotted that I got it to match. Wonder if that is a similar issue that you have seen?

Last Edited: Fri. Oct 27, 2017 - 08:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried every option.  They do now have an option to not augment and even an option for least to most or most to least bits.

 

No matter, I already had code to read HEX files, I just needed a function to write HEX files so I put it together last night.

 

CRCVSTOOL 1.00 (CRC16 Version Serial Tool)

Usage:
  crcvstool filename size version [serial]

This tool will expand filename (Intel HEX format) by padding it up to size
with 0xFF.  It will then write a 4 byte or 8 byte tag at the end depending on
whether the serial option is specified or not.

No serial:
  4 byte tag @ [size-4] --> Version[2] Crc16[2]

Serial:
  8 byte tag @ [size-8] --> Version[2] Crc16[2] Serial[4]
C:\temp>crcvstool file.hex 32768 1.14 41001
CRCVSTOOL 1.00 file.hex [size 12368, flash 32768, crc 0xf533, serial 41001]