View previous topic :: View next topic |
Author |
Message |
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
Bootloader Problem 18F66K22 |
Posted: Wed Jun 05, 2019 7:18 am |
|
|
Hello
My compiler 5.078
I am using a program that uses an ADXL365 and an MS5611 with I2C link
and PIC 18F66K22 at 20MHz.
The program compiles and works. MEMORY USE RAM 54% ROM 13%
I am trying to use the bootloader found in the CCS samples.
I tried the bootloader mode with different program (flashing LED + RS232 to TERMINAL)
All these programs made with and without bootloader.
The ADXL345 and MS5611 program does not compile if I add:
#include <bootloader.h>
It generates the errors below:
>>> Warning 228 "18F66K22_accel_alti.c" Line 58(9,15): Memory not available at requested location
--- Info 300 "18F66K22_accel_alti.c" Line 793(8,9): More info: Segment at 00000-004FE (0000 used) Priv
--- Info 300 "18F66K22_accel_alti.c" Line 793(8,9): More info: Segment at 00500-0FFFE (0000 used)
--- Info 300 "18F66K22_accel_alti.c" Line 793(8,9): More info: Segment at 10000-1FFFE (0000 used)
--- Info 300 "18F66K22_accel_alti.c" Line 793(8,9): More info: Attempted to create: 00002-00004 for reset
*** Error 126 "18F66K22_accel_alti.c" Line 793(8,9): Invalid ORG range
1 Errors, 1 Warnings.
Build Failed.
Thanks in advance for your help
Best regards
Cogitum |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19543
|
|
Posted: Wed Jun 05, 2019 9:36 am |
|
|
Also, post what is actually 'in' line 793 of 18F66K22_accel_alti.c.
Remember if the code itself contains #ORG statements (or anything else
that forces compilation 'at' a specific address), these will need to be changed
to match the new address when the bootloader is used. |
|
|
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
Bootloader Problem 18F66K22 next |
Posted: Thu Jun 06, 2019 3:02 am |
|
|
Hello PCM programmer
Hello Ttelmah
Thank you both for your answers.
I did another test with ADXL365 alone.
The result is the same.
Line 783 is: "}."
The same line 793 "}" in the ACCEL + ALTIMETER program
=======================================
Here are the lines from the beginning of the ACCEL ALONE program
=======================================
Code: | #include <18F66K22_accel_alti.h>
// #include <bootloader.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
//! #zero_ram
#define ACCEL_WRITE_ADDR 0XA6 // suivant cablage !
#define ACCEL_READ_ADDR 0XA7
#define ACCEL_DATA_ADDR 0x32
#define ACCEL_PWRCTRL_ADDR 0x2d
#define ACCEL_MEASURE_MODE 0x08
#define BP PIN_B0
//_____ M A C R O S
#define ADDR_W 0xEE // Module address write mode suivant cablage
#define ADDR_R 0xEF // Module address read mode
#define CMD_RESET 0x1E // ADC reset command
#define CMD_ADC_READ 0x00 // ADC read command
#define CMD_ADC_CONV 0x40 // ADC conversion command
#define CMD_ADC_D1 0x00 // ADC D1 conversion Pression
#define CMD_ADC_D2 0x10 // ADC D2 conversion TEMPERATURE
#define CMD_ADC_256 0x00 // ADC OSR=256
#define CMD_ADC_512 0x02 // ADC OSR=512
#define CMD_ADC_1024 0x04 // ADC OSR=1024
#define CMD_ADC_2048 0x06 // ADC OSR=2048
#define CMD_ADC_4096 0x08 // ADC OSR=4096
#define CMD_PROM_RD 0xA0 // Prom read command
//#define LED_TEST PIN_B5
//
#define EEPROM_ADRESS 10 // Location in EEPROM 10
#build(reset=0x0002)
#ROM 0 = {0xFFFF} // Insert NOP at address 0
#define max_buffer_size 150 // Taille maxi
#define TempsGeoOn 300 // 60 // Temps attente geo ON en secondes, soit 10 Minutes
#define TempsGeoOffCourt 900 // 120 // Temps attente geo Off COURT (si PinB3 à 0)en secondes soit une journée
#define TempsGeoOffLong 1800 // 180 // Temps attente geo Off LONG (si PinB3 à 1) en secondes, soit 7 jours |
Best regards
Cogitum |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Thu Jun 06, 2019 5:13 am |
|
|
this...
makes no sense to me...
Please post the lines above that line.
The original error sounds like the 18F66K22_accel_alti.c code wants to be located at a specific memory location.
You should post that code as well, at least the first few lines of code.
Jay |
|
|
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
Bootloader Problem 18F66K22 next_02 |
Posted: Thu Jun 06, 2019 5:55 am |
|
|
Hello Temtronic,
Thanks for your help
I agree with you "no sense" but however ...have a look ;
(it' not the same line number after some change) now number is 605
Maybe I solve the problem ...
Line 37 #define EEPROM_ADRESS 10 // Location in EEPROM
Line 38 #build(reset=0x0002)
Line 39 #ROM 0 = {0xFFFF} // Insert NOP at address 0
IF I put this 3 lines in "REM" i can compile the program.
After another test ONLY with LINE 38 in REM I can compile too.
Best regards
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9244 Location: Greensville,Ontario
|
|
Posted: Thu Jun 06, 2019 7:21 am |
|
|
Put those 3 line back in, and compile, when it fails, remark ONE line, recompile. If it does compile then the 'remarked' line is the problem. |
|
|
Cogitum
Joined: 22 Mar 2012 Posts: 70 Location: France (Paris)
|
Bootloader Problem 18F66K22 SOLVED |
Posted: Thu Jun 06, 2019 8:13 am |
|
|
Hello Temtronic
I have already done this test. Indeed this line generates the error and the compiler does a little anything.
#build(reset=0x0002)
PREVIOUS MSG :
After another test ONLY with LINE 38 in REM I can compile too
Thanks for your help
Best regards |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19543
|
|
Posted: Thu Jun 06, 2019 11:40 am |
|
|
This is not going to work:
Line 37 #define EEPROM_ADRESS 10 // Location in EEPROM
Line 38 #build(reset=0x0002)
Line 39 #ROM 0 = {0xFFFF} // Insert NOP at address 0
The _bootloader_ is at address 0.
You need to move this to be above 'loader end'.
Why have you got this?. What is the point of putting a NOP at address 0?. |
|
|
|