Main Site Documentation

Native Debugging with FEZ Hydra


#1

Hi,

I have a FEZ Hydra board and I am working on some native libraries that I will have to debug. I have installed the CrossStudio IDE and have an Atmel SAM-ICE JTAG interface wired to the board. There are two things I would like to be able to do: download and debug programs into external memory on the board, and debug my native library with source.

  1. I have an example project loaded in CrossStudio, and I want to download it to the board and debug it. The IDE gives me the option of running the code in internal memory, SDRAM, or FLASH. I am able to debug my project from internal RAM, but not from SDRAM or flash. When I select SDRAM as the placement and attempt to debug, the project builds and appears to be downloaded to the board. However, the IDE then verifies the code and the contents of the memory are completely different from what they should be. (I would guess this means that the tools are for some reason not able to download the code into the external memory.)
    I don’t have any success trying to download the program to flash, either. When I try to build the project, the linker throws errors such as “undefined reference to ‘data_start’” (and data_load_start, data_end, text_start, etc…) and "undefined reference to ‘FLASH_segment_start’.

Why am I unable to download programs to SDRAM, and how do I address these linker errors when building for FLASH placement?

  1. I want to be able to debug the native code that I expose through .NET interop, using the debugging tools in CrossStudio. Here’s what I am currently able to do: First, I load a C# program that makes calls to my native libraries. Next, I create an externally built project in CrossStudio and select tinyclr.axf as the executable. I can then attach the debugger and debug at the assembly level. I’m wondering if source-level debugging is possible here and what I have to do to enable it. Would this have something to do with building TinyCLR with /p:flavor=debug, or is this not possible?

I’d appreciate any help or suggestions. Thanks.


#2

Yes, you need to build the project with flavor=debug. Set a breakpoint at the entrypoint to your native function, and when you call it from TinyCLR, it should hit the breakpoint.

As for your debugging issues, I think it has to do with the scatterfile you’re using for your standalone project. CrossStudio doesn’t magically know how much Flash/RAM you have on your Hydra, and how it’s hooked up to your board. You’ll need to specify all of that to the program.

Luckily, TinyCLR.axf has all that information in it – you should be able to debug it relatively easily. I’ve never used CrossStudio, but Keil works well at debugging external binaries. You may need to specify the search path – otherwise, the debugger won’t know where to look to find the source files.

Good luck!