cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

CrVi_1101311
New Contributor II
CY_ISR(IntDefaultHandler)
Hi,
Just before execute this line of code(Debugging mode):
                    case TAMANO_WORD:
--->                  *p_Dato = *p_LocalMemoria->p_UnionDirMemoriaPrincipal.p_Word;
                    break;
The software jumps  to a Cm0olusStart.c
CY_NORETURN
CY_ISR(IntDefaultHandler)
{....
How is it possible? 
How Can I know What´s happen?
Thanks.
Cancelled                         This is the help of Cypress....                                 
03/13/2018
0 Likes
Reply
1 Solution
CrVi_1101311
New Contributor II

Hi,

I have found  the real problem.

I have used  #pragma pack() to define this variable struct (to compact the variables and save them in an external eeprom).

This directive causes the problem.

I will have to think about keeping only words in the external eeprom.

Thank you and best regards.

View solution in original post

5 Replies
CrVi_1101311
New Contributor II

I put Heap size in 0x900 and the problem persist.

The problem occurs when I have to work with this Struct:

    typedef struct

    {

        UnionAverias_t UnionAverias;      //(word)

        UnionAverias_t UnionAveriasAnt;//(word)

        uint8 ui8_BitAveriaEnCurso;

        UnionRoturas_t UnionRoturas;  //(word)

        UnionRoturas_t UnionRoturasAnt; //(word)

        uint8 ui8_BitRoturaEnCurso;

        UnionAvisos_t UnionAvisos;   //(word)

        UnionAvisos_t UnionAvisosAnt;   //(word)

        uint8 ui8_BitAvisoEnCurso;

        UnionModoAveriasAvisos_t UnionModoAveriasAvisos; //(word)

        uint8  ui8_PrioridadAveriasAvisos;

        uint8  ui8_PrioridadAveriasAvisosAnt;

        uint16 ui16_Cont20msgZumbador;

    } EstadoAveriasAvisos_t;

It is too long? or similar?

Thanks.

0 Likes
Reply
JoMe_264151
Expert II

The IntDefaulthandler() is jumped to in case of an error occured. This (quite often) is an addressing error due to a busted array, clobbered stack or nil/bad pointer. I would suggest you to

  • Set compiler optimization to "none"
  • Set a breakpoint at the line in question
  • Change when BP reached to disassembly view
  • Single asm-step through the code and watching for pointers and stack

Bob

0 Likes
Reply
CrVi_1101311
New Contributor II

Thanks, Bob.

Thankfully, people like you are in the forum ...

If I compile in NONE mode, the program roms overflows.  I'm using 49k of 64k.

I can only compile in DEBUG mode.

In disassembly mode, it does not say much ... you´ll see  registers (ldr r3, [r4, #4]) that are loaded and then jump to IntDefaultHandler again ...

I think the fail is dueto the size of the structure that I'm putting in the pointer.

Would you tell me please, in what register have I to see?

Thank you, Bob.

I think, the debug does not stop exactly where it should ...

153:                     case TAMANO_WORD:

154:                         *p_Dato = *p_LocalMemoria->p_UnionDirMemoriaPrincipal.p_Word;

0x00005C42 ldr r3, [r4, #4]

0x00005C44 ldrh r3, [r3, #0]

0x00005C46 strh r3, [r5, #0]

jumps to CY_ISR(IntDefaultHandler)

0x00007FB8 ldr r4, [r5, #8]

327:             unsigned count;

328:             for (count = 0u; count != limit; count += sizeof (uint32))

Register values when fail occurs.

pastedImage_0.png

0 Likes
Reply
Anonymous
Not applicable

The problem looks like you are dereferencing the pointer twice to get the value, and then assigning that value to a pointer. I suspect the issue is with incorrect pointers/referencing in your code.

Also, the structure EstadoAveriasAvisos_t has no member p_Word, so it looks like the structure you posted is different from the structure you are using.

Using a pointer to a structure containing the variable would be fine, but if you dereference the pointer to the structure, you now have a structure, and then you dereference the structure member p_word, you will end up with the value of p_word, not pointer to it. Which you are then trying to assign to a dereference of p_Dato, which sounds incorrect. But, to know for sure, you would have to show us the declaration of p_Dato and EstadoAveriasAvisos_t.

0 Likes
Reply
CrVi_1101311
New Contributor II

Hi,

I have found  the real problem.

I have used  #pragma pack() to define this variable struct (to compact the variables and save them in an external eeprom).

This directive causes the problem.

I will have to think about keeping only words in the external eeprom.

Thank you and best regards.

View solution in original post