XMegaForArduino / arduino

required (and optional) source files for the Arduino development environment, specifically the hardware/arduino sub-directory, to support xmega processors
19 stars 17 forks source link

bootloader not 'flashing' on atxmega128a1u #17

Closed bombasticbob closed 9 years ago

bombasticbob commented 9 years ago

flash protocol currently not working on the atxmega128a1u using updated bootloader code.

bombasticbob commented 9 years ago

also fixed problem with 'jump to zero'. It appears that when there's an EIND register (for >128k bytes of address space, which the 128a1 has because its bootloader is >128k) the normal way of invoking the boot code doesn't work. what DOES work is push 3 0's and do a 'ret' (because of the 3-byte instruction pointer). However, it does not appear that the IVT is pointing at the right address afterwards. This needs to be researched a bit more as well.

bombasticbob commented 9 years ago

worth mentioning, the flash code is behaving 'oddly' like there is memory stomping going on. for some reason, the main array is being assigned to 'wrong values' compared to what was actually sent. This may be a bug elsewhere, but the 'arduino' protocol still works ok so it's not "the basics" of serial I/O or anything like that. It's a problem specific to the 'wiring' protocol and the code that runs it, and the larger buffer that's needed, and the fact that it's not receiving the data bytes properly (or they're getting corrupted somehow).

bombasticbob commented 9 years ago

the 'arduino' protocol works when I use a test target to create a bootloader and flash with 'arduino' protocol. So the only problem is the 'wiring' protocol, which has some very very very strange problems in it. The SAME code works on the 64D4 so something weird is happening where the data byte returned from 'getch' comes back as a ZERO and I get checksum errors... perhaps I need to add a delay after each 'getch' ? before each getch?

bombasticbob commented 9 years ago

works now, seemed to be a compatibility problem with the 'copy-pasted' code from the original stk500v2 Arduino bootloader. declaring variables after executing statements in a section might have been the cause. Sure the compiler "lets you" but it's bad practice. taking those out 'fixed' it.