Hi. I have a galileo gen2 board with a fully featured micro SD card on board. So I have this project where I need to make certain changes to the assembly code which is generated for the source code which is gonna be run on the galileo board. Right now I am using a normal Blink example.
I have the eclipse IDE but I wasn't able to find any particular plugin which could help me in making assembly level changes to the blink code and upload that to the board. I have a cross compiler toolchain setup on my workstation as well. So my question is is it possible to run blink code on my galileo board if I cross compile the blink code using the cross compile toolchain and then transfer the binary to the galileo board over to the linux image through ssh and execute it over there? I tried cross compiling the source code given below but my toolchain wasn't able to find "mraa.h".
# include "mraa.h"
# include
# include
int main()
{
// select onboard LED pin based on the platform type
// create a GPIO object from MRAA using it
mraa_platform_t platform = mraa_get_platform_type();
mraa_gpio_context d_pin = NULL;
switch (platform) {
case MRAA_INTEL_GALILEO_GEN1:
d_pin = mraa_gpio_init_raw(3);
break;
case MRAA_INTEL_GALILEO_GEN2:
d_pin = mraa_gpio_init(13);
break ;
case MRAA_INTEL_EDISON_FAB_C:
d_pin = mraa_gpio_init(13);
break;
default:
fprintf(stderr, "Unsupported platform, exiting");
return MRAA_ERROR_INVALID_PLATFORM;
}
if (d_pin == NULL) {
fprintf(stderr, "MRAA couldn't initialize GPIO, exiting");
return MRAA_ERROR_UNSPECIFIED;
}
// set the pin as output
if (mraa_gpio_dir(d_pin, MRAA_GPIO_OUT) != MRAA_SUCCESS) {
fprintf(stderr, "Can't set digital pin as output, exiting");
return MRAA_ERROR_UNSPECIFIED;
};
// loop forever toggling the on board LED every second
for (;;) {
mraa_gpio_write(d_pin, 0);
sleep(1);
mraa_gpio_write(d_pin, 1);
sleep(1);
}
return MRAA_SUCCESS;
}
Link Copied
Hello prashast.srivastava,
In fact you could compile your code directly from Linux. Which image are you using? If you are using the uclibc image, you have to download the packagegroup-core-buildessential package from http://alextgalileo.altervista.org/package-repo-configuration-instructions.html AlexT's repo as well as gcc, g++ or any other compiler you need, MRAA can also be downloaded from http://alextgalileo.altervista.org/package-repo-configuration-instructions.html AlexT's repo.
If you are using the eglibc image, all the stuff needed to compile should already be there.
To compile a C code on Linux you will have to:
To update the packages on the eglibc image (including MRAA) you can follow this guide: https://software.intel.com/en-us/articles/managing-devkit-libraries-intel-edison-or-intel-galileo-bo... IoT - Upgrading Intel® IoT Developer Kit libraries – Intel® Edison or Intel® Galileo board | Intel® Developer Zone
Peter.
Hello prashast.srivastava,
In fact you could compile your code directly from Linux. Which image are you using? If you are using the uclibc image, you have to download the packagegroup-core-buildessential package from http://alextgalileo.altervista.org/package-repo-configuration-instructions.html AlexT's repo as well as gcc, g++ or any other compiler you need, MRAA can also be downloaded from http://alextgalileo.altervista.org/package-repo-configuration-instructions.html AlexT's repo.
If you are using the eglibc image, all the stuff needed to compile should already be there.
To compile a C code on Linux you will have to:
To update the packages on the eglibc image (including MRAA) you can follow this guide: https://software.intel.com/en-us/articles/managing-devkit-libraries-intel-edison-or-intel-galileo-bo... IoT - Upgrading Intel® IoT Developer Kit libraries – Intel® Edison or Intel® Galileo board | Intel® Developer Zone
Peter.
Thanks a lot for the info. Was able to make the desired changes in the assembly code and then was able to run it as well.
For more complete information about compiler optimizations, see our Optimization Notice.