This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Crossworks HRM Example

Hi, I'm having a bit of trouble getting the broadcast or HRM example to work. I'm using crossworks and after my last question, removed the retarget.c file and the code compiled without errors. However upon trying to download the code to my PCA 10028 board I would get an error with regards to discrepancies in memory. After some investigation I assumed this was due to the fact that due to some improper configuration on my part I was trying to download code over the S210 Softdevice. I edited the memory map file for the board to account for the soft device making the following changes.

MemorySegment name="FLASH" access="ReadOnly" start="0x0000D000" size="0x33000" /

...

MemorySegment name="RAM" start="0x20000900" size="0x3700" /

The start location for Flash was changed from 0x00000000 to 0x0000D000 and the size was reduced by 52kb, the RAM start location was changed from 0x20000000 to 0x20000900 and the size was reduced by a corresponding amount. The code for both the broadcast and HR examples now downloads on to the board but neither appears to detect the ANT+ Heart Rate Monitor I'm wearing. Nothing prints to my debug terminal and I'm at a bit of a loss as to why. Have I edited the memory map incorrectly? Is there something else I need to configure in my code? Alternatively does the demo not detect the type of ANT device I'm wearing (it's just a Garmin HR monitor from my bike computer). Any help is appreciated!

  • No don't touch those, those are chip definition macros. You need to tell Crossworks a number of things, where to build this piece of code, to download it without wiping the chip and where to start debugging. There was a post about this a few years ago which I cribbed from. However the forum search appears not to go back very far any more and I can't find the post now.

    So put the project back the way it was and then you need the following things defined (use the properties window at the 'project' level and the search box to find the properties you need), each of these lines is the name in the crossworks file, see below for the friendly GUI names

    • linker_section_placement_macros: FLASH_START=0x0d000;RAM_START=0x20000900
    • target_loader_erase_all: NO
    • debug_entry_point_symbol: nonexistant

    I have a few more but those are the important ones. The first (friendly name is 'Section Placement Macros') tells Crossworks where to build your code. The second one (friendly name is 'Erase All' and it's under the Flash properties) tells Crossworks not to just do a full chip erase on install. The last one is for debugging and I don't quite remember what happens if you don't define it, i think it tries to debug in the softdevice or something.

    I actually have a home-built hzq package which I recently updated for SDK 7.x (which was a royal PITA) which generates templates for Crossworks for Nordic with softdevice and different targets etc. It exposes those as properties you can change (eg change s110 to s120) and that sets up all the correct variables to build the code and have it install in the right place. If you want to try that out please contact me off-list and I'll send it to you and see if I can help you get started, I wrote it for me so there's a bit of set up required.

  • When I define the Section Placement Macros and attempt to build the project I receive a syntax error at the point that Crossworks generates the linker files and attempts to link to the .elf file. It specifies, nrf51422_xxac.ld:55: syntax error. When I open the specified file at line 55 I find the following code,

    vectors_load_start = 0x0D000;RAM_START=0x20000900; .vectors 0x0D000;RAM_START=0x20000900 : AT(0x0D000;RAM_START=0x20000900)

    My macro definitions have the following syntax

    FLASH_START=0x0D000;RAM_START=0x20000900.

    Which follows the example provided and seems to conform to other examples I can find online. I'm not super sure what to do next.

  • It's interpolated the whole line as one macro definition and not two

    Double-click the 'section placement macros' and you should get a dialog box with two lines in it, one for FLASH_START and one for RAM_START, one below the other. Yes they turn up in the file later separated by a semicolon, but I think you've managed to get it so the semicolon is part of one of the definitions so effectively FLASH START is defined as '0x0d0000;RAM_START-0x20000900' instead of FLASH_START and RAM_START being defined separately.

    Having tested what I think you've probably done, if you look at the hzp file it should look like this

    linker_section_placement_macros="FLASH_START=0x0d000;RAM_START=0x20000900"
    

    I suspect yours looks like this (note the escaped semicolon which makes the whole thing a definition of FLASH_START)

    linker_section_placement_macros="FLASH_START=0x1d000\;RAM_START=0x20002800"
    
  • Thanks for the answer, I got that corrected when I wrote the Macro definitions on separate lines, seemed to stop the interpolation for some reason.

Related