Our firmware design requires custom firmware images for different hardware functions. In order to choose between them, we provide a custom boot loader code [ init(), checkCandidateImageVersion() etc], as described in XMOS documentation. XDE12 and XDE11 tools used to produce correct bootloader and binary images without any issues. However, XDE13 and XDE14 display error messages, and won't produce any firmware images.
Our custom loader code tests for specific pin (port), and chooses correct image accordingly. The port is declared in loader.xc this way:
in port hw_mode = XS1_PORT_1I;
Our design is based on the U16 CPU, and XDE13/XDE14 show the following error message when executing xflash with such custom loader.xc:
"xmap: Error: Port hw_mode is not placed on a specific tile."
Declaring the port as 'on tile[0]:' won't work ("extern tileref tile[]; on tile[0]: in port hw_mode = XS1_PORT_1I"): xflash shows another error code: "loader.xc: Error: Undefined reference to 'hw_mode'".
xflash (14.0.4) verbose output:
XFlash::BuildFlashBinaryFile
XFlash_Builder_S2L::BuildStage2Loaders Factory
Stage2_Loader::Compile : xcc -Wno-bidirectional-buffered-port -Xmapper --dontenablesodlinks -Xmapper --nochaninit -Xmapper --noinitialtidy -Xmapper --image-base -Xmapper 0x10080 -Xmapper --image-size -Xmapper 0xff80 -Xmapper --wno110 -Xmapper --wno226 -Xmapper --wnoXN -std=c99 -O2 -x xn "target-xn-v0-a731f5cc" -x xc s2l-n0-86fab114 -lstage2loader_l1 -lswitchsetup_l1 -lspiaccess -x none loader.o -lxcc -o s2l-n0-7d73c3e4
xmap: Error: Port hw_mode is not placed on a specific tile.
Error: F03010 Failed to compile
It seems the issue is similar to this one: https://www.xcore.com/forum/viewtopic.php?f=26&t=3110
Thanks for any hints on this topic.
custom loader code on multi-tile devices
-
- New User
- Posts: 2
- Joined: Wed Jul 15, 2015 8:27 pm
-
- XCore Addict
- Posts: 158
- Joined: Thu Mar 20, 2014 8:04 am
Hi, is it possible to raise a bug-report through XMOS ticket service system:
https://www.xmos.com/support/contact/report-a-bug
It will be helpful to mention the tools version, host and IP details used so that its easy to replicate the issue.
https://www.xmos.com/support/contact/report-a-bug
It will be helpful to mention the tools version, host and IP details used so that its easy to replicate the issue.
-
- Member++
- Posts: 24
- Joined: Thu Aug 14, 2014 10:55 am
Hi,
I verified the issue now and it is a bug in the tools. As suggested by Srini, please raise a bug report.
Meanwhile, i have got a (dirty) workaround for this and it is completely in assembly
unsigned p_button = XS1_PORT_4F;
void init(void)
{
unsigned buttonVal;
/* Read state of button. */
asm volatile("setc res[%0], %1" : : "r"(p_button), "r"(XS1_SETC_INUSE_ON));
asm volatile("in %0, res[%1]" : "=r"(buttonVal) : "r"(p_button));
/* Now 'buttonVal' will have the button value */
}
I verified the issue now and it is a bug in the tools. As suggested by Srini, please raise a bug report.
Meanwhile, i have got a (dirty) workaround for this and it is completely in assembly
unsigned p_button = XS1_PORT_4F;
void init(void)
{
unsigned buttonVal;
/* Read state of button. */
asm volatile("setc res[%0], %1" : : "r"(p_button), "r"(XS1_SETC_INUSE_ON));
asm volatile("in %0, res[%1]" : "=r"(buttonVal) : "r"(p_button));
/* Now 'buttonVal' will have the button value */
}
Code: Select all
Hope it helps!Cheers,Krishna
-
- New User
- Posts: 2
- Joined: Wed Jul 15, 2015 8:27 pm
Hello Krishna,
Thank you for your prompt feedback. Your workaround works fine with XDE14. I hope a fix for xTimeComposer 14 will become available soon.
Thank you for your prompt feedback. Your workaround works fine with XDE14. I hope a fix for xTimeComposer 14 will become available soon.
-
- Member++
- Posts: 16
- Joined: Fri Jul 15, 2016 6:35 am
I had the same problem. My fix was to specify which tile the port is placed in and include the <platform.h>...
// Copyright (c) 2016, XMOS Ltd, All rights reserved
#include <xs1.h>
#include <platform.h>
/* Port for buttons */
in port p_button = on tile[0]: XS1_PORT_4D;
// Copyright (c) 2016, XMOS Ltd, All rights reserved
#include <xs1.h>
#include <platform.h>
/* Port for buttons */
in port p_button = on tile[0]: XS1_PORT_4D;