Page 1 of 1

SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Wed Oct 22, 2014 7:30 am
by tomshirvo
I have been converting the "Atmel-42141-SAM-AT02333-Safe-and-Secure-Bootloader-Implementation-for-SAM3-4_Application" to Atmel Studio 6.2.

I have got the bootloader working without the encryption in but I am now trying to add it back.

I keep getting errors about the 'ulong32' data type that are used in the TomCrypt library.

Is anyone able to tell me why and what I should do to stop these errors. 

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Thu Oct 23, 2014 12:43 am
by jharley
The compiler is telling you that it cannot find the definition of this type when it compiles this file.

Most likely you are missing a header file...

tomcrypt_macros.h

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Tue Oct 28, 2014 2:15 am
by tomshirvo
Having more problems, I have solved a few but I am now stuck on these errors.

I have added all of the header files into the include paths but that doesn't seem to help on this error

Image showing errors

https://www.dropbox.com/s/duf4mcufn4doj ... 2.png?dl=0

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Wed Nov 12, 2014 7:17 pm
by tallman
Hello tomshirvo,

Did you get this to work - libTomcrypt in atmelstudio ?  I'm doing this now shortly after you, and found your message when I hit the same error.  Any advice would be appreciated.

Brent

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Wed Nov 19, 2014 6:05 am
by tomshirvo
No I got stuck and have moved on to another project at the moment. Have you had any luck since your post?

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Wed Nov 19, 2014 11:02 pm
by tallman
Actually did get it all done.  I was happy.  Had to spend little time working through the bugs it produced.  Mostly Defines not set as I remember or headers getting included multiple times(it was week ago and I forgot most already). 

Oh one thing I did have to do is take the current tomcrypt from the website and when I had trouble with a program/header from the Atmel example code, compare the two as the one on the tomcrypt site had been fixed in some cases.

I was really happy with how easy this solution ended up being to implement (after the bugs) 

Brent

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Wed Nov 19, 2014 11:47 pm
by tomshirvo
Brent,

Good job, I was pulling my hair out for a while.

Are you willing to share the code and project file. There are a few people out there I have found that have wanted this including myself. 

Thanks

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Mon Dec 08, 2014 3:03 am
by tomshirvo
Hi Brent,

Working on this bootloader again I am not having any luck at all. 

I have disabled the Tomcrypt part of the bootloader just to try and get the thing to work. I have been able to get the bootloader on the chip and get the firmware uploaded onto the device through the bootloader but I can't get the program to run. I just compiled the simple "Blink" program and uploaded the .bin file. 

Image

I thought it might be because I had to put the bootloader in both of the flash areas. I did that with the SAM-BA  but that still didn't work.

Also wondering if it has something to do with the code start at the top of the bootloader main.c file. It doesn't look like the HEX values are correct so I will play around with that.

Image

Any help would be great.

Re: SAM3X8 Safe and secure bootloader Tomcrypt problems

Posted: Mon Dec 08, 2014 2:48 pm
by tallman
Just to confirm your saying your uploading bootloader, then had it upload your code, and run, and it's not starting.

Make sure you compiled your bin in correct memory location with .text=0x0080 if thats where your firmware will reside in flash and run.  Also you don't start it at that address.  You start at an offset.
I used atmels doc
Atmel-42141-SAM-AT02333-Safe-and-Secure-Bootloader-Implementation-for-SAM3-4_Application-Note
 and the example project for bootloader as example.  I know the two things I mentioned gave me trouble, until I figured out how they work.

Also you might start a new thread rather than associating this with Tomcryptlib.
Brent