Building multiple images from same source

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

I have an (ATMega1284p) "solution" that consists of two major components:

 

a) The firmware application itself

b) A bootloader specific to the application

 

I have two hardware boards that are targeted by this application.  The newer board contains I2C devices that the earlier board does not have as well as other circuit changes (ports, etc.).

 

I have code that can detect which hardware it is running on.

 

I have enough application Flash so that the application can determine which board it has been loaded to and execute the appropriate code depending on the hardware it is running on (application contains support for both boards).  I want to keep this as one image because it makes distribution easier.

 

I do not have enough bootloader Flash to support a single image with support for both hardware platforms.

 

I would like to setup two Atmel Studio projects for the two bootloader images that share identical source files but have different symbols "defined" in the project properties to allow #if directives in the source to select the appropriate support code for the hardware in use and generate the appropriate hex/elf image ... one for each platform.  Distribution is not an issue because I load the bootloader specific to the board before sending it out.

 

I know that I could do it by building one bootloader, changing the 'target' and symbol and building again but I want all three images (application, bootloader a, bootloader b) generated when the 'solution' is built.

 

Is there a way to do this?

 

Regards,

 

Chuck

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


ChuckH wrote:
Is there a way to do this?
Yeah just make three projects in the solution:

 

 

Use "Add as Link" to add the sources for app_variant1 and app_variant2 from the common location (throw away any new main.c that is auto-created when you first add the projects). Then in "Symbols" for each project just make the -D's that define which bits to build in.

 

Now you just "Build Solution" and all three bits are built in one go.

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

clawson wrote:

Use "Add as Link" to add the sources for app_variant1 and app_variant2 from the common location (throw away any new main.c that is auto-created when you first add the projects). Then in "Symbols" for each project just make the -D's that define which bits to build in.

 

Now you just "Build Solution" and all three bits are built in one go.

 

That was what I thought but I had tried that and every file I "added as link" came up in the solution explorer with an error and could not be opened (said file did not exist).

 

I tried it again this morning and got the same thing but I then opened the "cproj" file in Programmer's Notepad and noticed that all the file links were similar to this:

 

<Compile Include="..\BC002%2520Bootloader%2520%28CAN%2520Bus%29\CAN_Bootloader.c">

Notice the "%2520" sequences which are its attempt at replacement spaces ... (should have been just %20 ??)

 

When I changed them to this all was well:

<Compile Include="..\BC002 Bootloader (CAN Bus)\CAN_Bootloader.c">

Seems Atmel Studio (7.0.1188) gets confused with " " or "(" or ")" in the path with links because when add new/existing I think the path & file come out fine.

 

Regards,

 

Chuck 

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

ChuckH wrote:
Seems Atmel Studio (7.0.1188) gets confused with " " or "(" or ")"
Unicode !

 

It kind of depends how you typed the "" in the first place. In a plain editor you hopefully always get ASCII character 0x22. In an "intelligent" editor (Word is one for example) it will try to use fancy opening and closing quotes. In Unicode an left (opening) double quote is 0x201C and a right (closing) double quote is 0x201D

 

Not sure what %2520 is though!

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

I have confirmed that "add link" works if the path does not contain an open paren '(' or close paren  ')' ... sigh ...

 

Things are working fine now ...