0

I have recently started working with Simplicity Studio to develop a program for a 8051 based development board. Via the configurator, I enabled Interrupts, which creates a Interrupts.c file. This file isn't being explicitly included in the main file, yet the interrupts defined there work as they should. Now, my concern is that I want to toggle a few flag variables from the interrupts, and use them in the main file. And since it is not explicitly included, the linker does not find the global variables of Interrupts.c and throws an error.

  1. I tried including the file explicitly, but I get the error L104: Multiple Function Definitions for all ISR functions as well as global variables.
  2. Tried making a function in the Interrupt file that only returns the global variables. That worked, but I cannot do that for every single variable, plus I won't be able to make changes in the main file and see it reflected in the Interrupts file.
  3. Tried using extern and defining in the main file, and I'm greeted with L127: Unresolved External Symbol as well as L128: Reference made to Unresolved External
  • Please provide a [mre]. The common way is to write a header file that declares all needed global variables. Include this header file in both your main source and the ISR's source. Choose a implementation file to define the variables. – the busybee Apr 02 '22 at 10:15

1 Answers1

0

In the Peripherals tab look for interrrupts. There usually is a setting "Generate Interrupt Functions". Disable this and include your own IRQ module to the sources.

Jens
  • 6,173
  • 2
  • 24
  • 43