Error unknown field 'pfnNMI_Handler' specified in intializer and 'pfnSVC_Handler specified in intializer'

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

 

Hi all,

I will take SAML22J16A to USB CDC boot loader by SAM-BA-MONITOR-ROMLESS but i found some error and it can not solve it.

please advice me to solve this problem or example code 

 

 

 

Last Edited: Thu. Feb 18, 2021 - 09:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So look at the code to which those messages relate.

 

Sounds like you're trying to initialise a struct, setting the fields by name (ie, using "designated initialisers") - but you've got the names wrong.

 

https://stackoverflow.com/questions/47202557/what-is-a-designated-initializer-in-c

 

So look-up the definition of the struct, and see what the correct names are.

 

 

EDIT

 

See this post https://www.avrfreaks.net/commen... on using the 'Output' window - instead of that error list view.

 

The messages in the 'Output' window would have given you a lot more information - including quoting the offending line, and pointing directly at where the error is.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Feb 18, 2021 - 09:15 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The error is in the vector table.  I ma not sure why, but here is how the vector table works

 

1) The structure "DeviceVectors" is specified in samxxxxx.h, where xxxx is the chip you are using, for example my atsaml22 design includes saml22n18a.h,

2) An instance of the structure is declared in startup_saml22.c and each vector assigned to a function

3) The functions are aliased to Dummy_handler so they can be replaced by use functions.

 

The error saying that startup.l22.c is setting pfnSVCall_Handler, but that is not specified in the structure.

 

 

John Malaugh

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

 

malaugh wrote:
1) The structure "DeviceVectors" is specified in samxxxxx.h, where xxxx is the chip you are using, for example my atsaml22 design includes saml22n18a.h

2) An instance of the structure is declared in startup_saml22.c and each vector assigned to a function

@manasa: you can find that startup file in your Solution Explorer:

 

And see where the structure instance is created - and the .pfnSVCall_Handler element gets initialised:

 

If you right-click the 'DeviceVectors' struct name, you will get the 'Go To Implementation' pop-up:

 

 

Click that to get to the struct definition:

typedef struct _DeviceVectors
{
  /* Stack pointer */
  void* pvStack;

  /* Cortex-M handlers */
  void* pfnReset_Handler;
  void* pfnNonMaskableInt_Handler;
  void* pfnHardFault_Handler;
  void* pvReservedM12;
  void* pvReservedM11;
  void* pvReservedM10;
  void* pvReservedM9;
  void* pvReservedM8;
  void* pvReservedM7;
  void* pvReservedM6;
  void* pfnSVCall_Handler;
  void* pvReservedM4;
  :
  :
  void* pfnTRNG_Handler;                  /* 25 True Random Generator */
} DeviceVectors;

 

 

The error saying that startup.l22.c is setting pfnSVCall_Handler, but that is not specified in the structure.

Indeed - but, from the above, pfnSVCall_Handler should be defined as an item in that structure.

 

So there must be something else wrong with the OP's Project!

 

@manasa: please do a 'Clean Solution', then a 'Build Solution', and then copy & paste the complete content of the 'Output' window.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Feb 18, 2021 - 04:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did anyone find a solution to this?

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

Just edit the startup .c file to match the current naming in the .h. Or create a new empty project and copy the startup .c file from that to your bootloader project.

/Lars

 

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

phillipscheng wrote:
Did anyone find a solution to this?

We never did find out from the OP what the actual problem was in order to solve it.

 

frown

 

in #4, awneil wrote:

The error saying that startup.l22.c is setting pfnSVCall_Handler, but that is not specified in the structure.

Indeed - but, from the above, pfnSVCall_Handler should be defined as an item in that structure.

 

So there must be something else wrong with the OP's Project!

 

@manasa: please do a 'Clean Solution', then a 'Build Solution', and then copy & paste the complete content of the 'Output' window.

@manasa never replied on that.

 

So perhaps you could do that - so we can see what's actually going on?

 

Or, perhaps, zip-up your project and post it?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. May 20, 2021 - 08:00 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

malaugh wrote:
The error saying that startup.l22.c is setting pfnSVCall_Handler, but that is not specified in the structure.

Just note that this is not what the error in post #1 is saying, so some renaming of the struct members has occurred, easy to fix as mentioned.

/Lars