Форум программистов, компьютерный форум, киберфорум
Микроконтроллеры
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.80/5: Рейтинг темы: голосов - 5, средняя оценка - 4.80
7 / 7 / 0
Регистрация: 29.06.2018
Сообщений: 1,536

Компиляция программы с прерываниями и таймерами на SDCC+GPASM

21.11.2021, 01:35. Показов 1189. Ответов 2
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//sdcc -mpic14 -p16f676 --use-non-free main.c
//sdcc    -mpic14 -p16f676  --use-non-free  -V     main676.c -L   C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
 
 
//#include </usr/share/sdcc/include/pic/pic16f676.h>
 
 #define NO_BIT_DEFINES 1
#define __16F676
 
// #include <pic14regs.h>
 #include <pic16f676.h>
 #include <stdint.h>
 
#define _XTAL_FREQ 4000000
//__CONFIG   _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT
 __code unsigned int   __at (_CONFIG)   __configword =_CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT;
 //_CONFIG is 0x2007
 
 
 
static void isr(void) __interrupt  0 {
 
      /*
      This is the interrupt service routine.  You'll find it at address
      0x004 in GPSIM just like if you were writing it in assembly. 
      
      Notice the use of 'interrupt 0' keyword in the function above.  This
      is how SDCC knows that this is the interrupt service routine.  We will
      only be using level '0' for PICs, therefore, you can use this same
      function in all your PIC applications.
      */
 
 
if (INTCONbits.T0IE){
if(INTCONbits.T0IF){
INTCONbits.T0IF = 0; // Clear timer interrupt flag  
TMR0  =0x7F  ; 
 
 PORTAbits.RA1 =0x01;
__asm nop __endasm;
 PORTAbits.RA1 =0x00;
 
}}
 
 
if (PIE1bits.TMR1IE){
if(PIR1bits.TMR1IF){
PIR1bits.TMR1IF = 0; // Clear timer interrupt flag  
TMR1H  =0xFB  ; 
TMR1L =0x1E  ;
 PORTCbits.RC1 =0x01;
__asm nop __endasm;
 PORTCbits.RC1 =0x00;
 
}}
 
}
 
 
void delay(uint16_t ms)
{
uint16_t i,j;
for (i = 0; i < ms; i++)
{
for (j=0; j < 4; j++)
__asm nop __endasm;
}
}
 
 
 
   /*
    The TMR0 interupt will occur when TMR0 overflows from 0xFF to
    0x00.  Without a prescaler, TMR0 will increment every clock
    cycle resulting in an interrupt every 256 cycles (or 256-TMR0_PRESET).  However, 
    using a prescaler, we can force that interrupt to occure at
    less frequent intervals.
    
    Each clock cycle is 1/4 the external clock.  Using that, and
    knowing the prescaler, we can determine the time interval for
    our interrupt.  
    OPTION_REG
    PS2 PS1 PS0 Ratio   Cycles  4MHz        10MHz
    0   0   0   1:2     512      512.0 uS    204.8 uS    
    0   0   1   1:4     1024     1.024 mS    409.6 uS
    0   1   0   1:8     2048     2.048 mS    819.2 uS
    0   1   1   1:16    4096     4.096 mS    1.638 mS
    1   0   0   1:32    8192     8.192 mS    3.276 mS
    1   0   1   1:64    16384   16.384 mS    6.553 mS
    1   1   0   1:128   32768   32.768 mS   13.107 mS
    1   1   1   1:256   65536   65.536 mS   26.214 mS 
    */
 
 
 
void main()
 {   
    TRISA=0x00;     // A-OUT
    TRISC=0x00;    // C-OUT
 
    CMCON = 0x07;           /* disable comparators */
 
    OPTION_REGbits.NOT_RAPU=1;
    OPTION_REGbits.INTEDG = 0;
    OPTION_REGbits.T0CS = 0;           /* clear to enable timer mode */
    OPTION_REGbits.T0SE = 0;   
    OPTION_REGbits.PSA = 0;                /* clear to assign prescaller to TMR0 */
    OPTION_REGbits.PS2 = 0;              
    OPTION_REGbits.PS1 = 0;  
    OPTION_REGbits.PS0 = 0;  
 
     INTCON = 0x00;             /* clear interrupt flag bits */
    
     INTCONbits.T0IE = 1;               /* TMR0 overflow interrupt enable */
    TMR0 = 0x7F;               /* clear the value in TMR0 or set TMR0 value  */
  // T1CON:—=0 TMR1GE=0 T1CKPS1=1 T1CKPS0=1 T1OSCEN=0 T1SYNC=1 TMR1CS=0 TMR1ON=0(1)
    TMR1H=0xFB;
    TMR1L=0x1E;
    PIE1bits.TMR1IE=1;
    T1CON=0b00000101;
     INTCONbits.PEIE=1; 
 
     INTCONbits.GIE = 1;                /* global interrupt enable */
 
 
 
 
while(1)
 { 
 
     PORTCbits.RC2 =1;
     __asm nop __endasm;
       //delay(25000); 
 
     PORTCbits.RC2=0;
    //  delay(25000); 
       //__delay_ms(250);   
 }
 
 }

Всегда ли правильно компилируются рестарты по адресу 0x0000 и 0x0004?

При установке SDCC и gputils в C:\SDCC и C:\gputils (в C:\Program Files b C:\Program Files (x86) иногда глючит от пробелов в имени и прав системы и админа как суперюзера ) выдает

Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
C:\Users\..\Desktop\New folder\test\16f676>sdcc    -mpic14 -p16f676  --use-non-free  -V     main676.c -L   C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
+ C:\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c11 -D__SDCC_PROCESSOR="16f676" -D__SDCC_PIC16F676 -D__SDCC_PIC14_STACK_SIZE=14 -obj-ext=.o -D__SDCC_CHAR_UNSIGNED -D__SDCC_USE_NON_FREE -D__SDCCCALL=0 -D__SDCC=4_1_12 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=1 -D__SDCC_VERSION_PATCH=12 -D__SDCC_REVISION=12748 -D__SDCC_pic14 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem "C:\SDCC\bin\..\include\pic14" -isystem "C:\SDCC\bin\..\include" -isystem "C:\SDCC\bin\..\non-free\include\pic14" -isystem "C:\SDCC\bin\..\non-free\include"  "main676.c"
+ C:\gputils\bin\gpasm.exe -o "main676.o" -c "main676".asm
main676.asm:106:Message[1304] Page selection not needed for this device. No code generated.
+ C:\gputils\bin\gplink.exe -I"C:\SDCC\lib\pic14\libsdcc.lib" -I"C:\SDCC\bin\..\lib\pic14" -I"C:\SDCC\bin\..\non-free\lib\pic14"  -I"C:\SDCC\bin\..\lib\pic14" -I"C:\SDCC\bin\..\non-free\lib\pic14"   -w -r -o "main676" "main676.o"   "C:\SDCC\non-free\lib\pic14\pic16f676.lib" "libsdcc.lib" "pic16f676.lib"
message: Using default linker script "C:\gputils\lkr\16f676_g.lkr".
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation of section "UDL_idata_0" failed, relocating to a shared memory location.
warning: Relocation of section "UDL_main676_0" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_idata_0" failed, relocating to a shared memory location.
Вложения
Тип файла: zip main676.zip (20.3 Кб, 5 просмотров)
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
21.11.2021, 01:35
Ответы с готовыми решениями:

Работа с прерываниями, таймерами - почему предпочтительна через DOSBox в Turbo Pascal ?
Допустим нужно заставить компьютер пропищать какую-нибудь мелодию. Почему это нельзя сделать просто через среду Turbo Pascal 7.0 ? ...

БЛОК_СХЕМА ПРОГРАММЫ С ПРЕРЫВАНИЯМИ
Пишу блок-схему алгоритма программы микроконтроллера. В программе возникают 2 прерывания: 1. Переполнение Таймера/счётчика 2. операция...

Проверка работы программы с внешними прерываниями
Здравствуйте, пишу небольшую подпрограммку: крутится цикл от 0 до 100, по int0 нужно записать 10 значений счетчика цикла в память, по int1...

2
7 / 7 / 0
Регистрация: 29.06.2018
Сообщений: 1,536
21.11.2021, 18:27  [ТС]
В следующем файле тоже

Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
C:\Users\..\Desktop\16f676test2\New folder>sdcc  --debug  -mpic14 -p16f676  --use-non-free  -V     main676.c    -L   C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
+ C:\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c11 -D__SDCC_PROCESSOR="16f676" -D__SDCC_PIC16F676 -D__SDCC_PIC14_STACK_SIZE=14 -obj-ext=.o -D__SDCC_CHAR_UNSIGNED -D__SDCC_USE_NON_FREE -D__SDCCCALL=0 -D__SDCC=4_1_12 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=1 -D__SDCC_VERSION_PATCH=12 -D__SDCC_REVISION=12748 -D__SDCC_pic14 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem "C:\SDCC\bin\..\include\pic14" -isystem "C:\SDCC\bin\..\include" -isystem "C:\SDCC\bin\..\non-free\include\pic14" -isystem "C:\SDCC\bin\..\non-free\include"  "main676.c"
+ C:\gputils\bin\gpasm.exe -g -o "main676.o" -c "main676".asm
main676.asm:334:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:366:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:370:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:400:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:404:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:410:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:414:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:1351:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:1355:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2410:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2414:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2462:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2466:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2525:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2529:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2657:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2661:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2717:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2721:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2883:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:2887:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3026:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3030:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3099:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3103:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3211:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3215:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3271:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3275:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3437:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3441:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3580:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3584:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3619:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3623:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3731:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3735:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3791:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3795:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3957:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:3961:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4100:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4104:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4139:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4143:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4600:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4604:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4610:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4614:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4620:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4624:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4807:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4811:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4817:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4821:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4827:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:4831:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5014:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5018:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5024:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5028:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5034:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5038:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5238:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5242:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5248:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5252:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5452:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5456:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5462:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5466:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5666:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5670:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5676:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5680:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5807:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:5811:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6250:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6254:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6395:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6399:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6524:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6528:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6824:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6828:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6953:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6957:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6985:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:6989:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:7017:Message[1304] Page selection not needed for this device. No code generated.
main676.asm:7021:Message[1304] Page selection not needed for this device. No code generated.
+ C:\gputils\bin\gplink.exe -I"C:\SDCC\lib\pic14\libsdcc.lib" -I"C:\SDCC\bin\..\lib\pic14" -I"C:\SDCC\bin\..\non-free\lib\pic14"  -I"C:\SDCC\bin\..\lib\pic14" -I"C:\SDCC\bin\..\non-free\lib\pic14"   -w -r -o "main676" "main676.o"   "C:\SDCC\non-free\lib\pic14\pic16f676.lib" "libsdcc.lib" "pic16f676.lib"
message: Using default linker script "C:\gputils\lkr\16f676_g.lkr".
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
error: No target memory available for section "S_main676__CheckButtons".
warning: Relocation of section "UDL_main676_0" failed, relocating to a shared memory location.
warning: Relocation of section "UDL_idata_0" failed, relocating to a shared memory location.
warning: Relocation of section "UD_main676_4" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_7" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_8" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_9" failed, relocating to a shared memory location.
error: No target memory available for section "IDD_main676_9".
error: Error while writing hex file.
+ C:\gputils\bin\gplink.exe -I"C:\SDCC\lib\pic14\libsdcc.lib" -I"C:\SDCC\bin\..\lib\pic14" -I"C:\SDCC\bin\..\non-free\lib\pic14"  -I"C:\SDCC\bin\..\lib\pic14" -I"C:\SDCC\bin\..\non-free\lib\pic14"   -w -r -o "main676" "main676.o"   "C:\SDCC\non-free\lib\pic14\pic16f676.lib" "libsdcc.lib" "pic16f676.lib"  returned errorcode 1
 
C:\Users\..\Desktop\16f676test2\New folder>rem  gplink -r -w -m -o a.hex a.o  C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
Как правильно настроить линкер, мейкфайл с gputils (программа не отлажена, может не содержать некоторых модулей, вместо них "заглушки" ) ?
Вложения
Тип файла: zip 16f676_linkerprroblem.zip (134.5 Кб, 5 просмотров)
0
7 / 7 / 0
Регистрация: 29.06.2018
Сообщений: 1,536
22.11.2021, 09:53  [ТС]
C второй программой память переполняется. Пробовал следующие :
Bash
1
2
make 
pause 0
и
Makefile
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#TARGET = prog
#PROCESSOR_FLAG=-mpic14
 
# Declare tools.
CC=sdcc 
AS=gpasm 
LD = gplink 
#ECHO = @echo
 
PROJ=main676
SRC=main676.c
EXEC=main676.hex
HEADERS = buttons.h ledio.h
 
#
TARGETPIC = 16f676
ARCH=pic14
DIR = pic14
OBJ= tmp.o
 
ASMFILE= tmp.asm
CFLAGS  =  -V --use-non-free -m$(ARCH) 
CFLAGS  += -p$(TARGETPIC)
#CFLAGS  +=-Wl 
#CFLAGS  += -o $(OBJ)
#CFLAGS +=  -I -Wl
# CFLAGS +=  -L   C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
CLIBS=  C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
 
#ASLIB+= -I"/home/test/gputils-1.5.0/header"
 
LDSCRIPT  =  16f676_g.lkr 
#LDFLAGS    =    -c -r -w -m  -s $(LDSCRIPT ) 
LDFLAGS    =      -r -w -m   
#LDFLAGS+= -Wl -bSEGNAME=0x7ff0
LDLIBS= C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
 
#sdcc --use-non-free -V -mpic14 -p16f676 -o $(OBJ)   -c  main676.c          
#sdcc -V -mpic14 -p16f676 -o $*.o -c main676.c  sdcc -Wl -bSEGNAME=0x7ff0  sdcc --codeseg SEGNAME -c file.c
#LIB = libsdcc.lib pic16f676.lib
 
 
all: $(EXEC)
# Compile
$(ASMFILE): $(SRC)
    sdcc     -V  --use-non-free -mpic14 -p16f676    -o $(OBJ)  -c $(SRC) -L $(CLIBS)
$(OBJ): $(ASMFILE)
    gpasm  -o $(OBJ)   -c $(ASMFILE) 
           
$(EXEC): $(OBJ)
    gplink  -r -w -m    -s  16f676_g.lkr      -o $(EXEC)  $(OBJ)    $(LDLIBS)
#rem  sdcc -S -V --use-non-free -mpic14 -p16f877 $<
#rem  mpasmwin /q /o $*.asm
#rem  mplink /v $(PRJ).lkr /m $(PRJ).map /o $(PRJ).hex $(OBJS)  libsdcc.lib
clean:
    rm  $(OBJ) $(ASMFILE)  $(PROJ:.hex=.lst)  $(PROJ:.hex=.map)  $(PROJ:.hex=.cod) 
 
#burn:
,

Bash
1
2
3
  sdcc  --debug   --use-non-free  -V     -mpic14 -p16f676  main676.c    -L   C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
  rem  gplink -r -w -m -o a.hex a.o  C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
pause 0

Bash
1
2
3
    sdcc     -V  --use-non-free -mpic14 -p16f676    -o tmp.o  -c main676.c   -L C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
    rem gpasm  -o tmp.o -c  tmp.asm 
    gplink  -r -w -m  -s  16f676_g.lkr     -o tmp.hex       tmp.o  C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
Добавлено через 2 минуты
Во втором файле (если отключить один модуль , не помещается, а на ассемблере может в альтернативной редакции)
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
C:\Users\user\Desktop\16f676test2\New folder>sdcc     -V  --use-non-free -mpic14 -p16f676    -o tmp.o  -c main676.c   -L C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
+ C:\SDCC\bin\sdcpp.exe -nostdinc -Wall -std=c11 -D__SDCC_PROCESSOR="16f676" -D__SDCC_PIC16F676 -D__SDCC_PIC14_STACK_SIZE=14 -obj-ext=.o -D__SDCC_CHAR_UNSIGNED -D__SDCC_USE_NON_FREE -D__SDCCCALL=0 -D__SDCC=4_1_12 -D__SDCC_VERSION_MAJOR=4 -D__SDCC_VERSION_MINOR=1 -D__SDCC_VERSION_PATCH=12 -D__SDCC_REVISION=12784 -D__SDCC_pic14 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem "C:\SDCC\bin\..\include\pic14" -isystem "C:\SDCC\bin\..\include" -isystem "C:\SDCC\bin\..\non-free\include\pic14" -isystem "C:\SDCC\bin\..\non-free\include"  "main676.c"
+ C:\gputils\bin\gpasm.exe -o "tmp.o" -c "tmp".asm
tmp.asm:266:Message[1304] Page selection not needed for this device. No code generated.
tmp.asm:364:Message[1304] Page selection not needed for this device. No code generated.
tmp.asm:366:Message[1304] Page selection not needed for this device. No code generated.
tmp.asm:372:Message[1304] Page selection not needed for this device. No code generated.
tmp.asm:374:Message[1304] Page selection not needed for this device. No code generated.
tmp.asm:376:Message[1304] Page selection not needed for this device. No code generated.
tmp.asm:378:Message[1304] Page selection not needed for this device. No code generated.
 
C:\Users\user\Desktop\16f676test2\New folder>rem gpasm  -o tmp.o -c  tmp.asm
 
C:\Users\user\Desktop\16f676test2\New folder>gplink  -r -w -m  -s  16f676_g.lkr     -o tmp.hex       tmp.o  C:\SDCC\lib\pic14\libsdcc.lib  C:\SDCC\non-free\lib\pic14\pic16f676.lib
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation of section "UDL_idata_0" failed, relocating to a shared memory location.
warning: Relocation of section "UDL_main676_0" failed, relocating to a shared memory location.
warning: Relocation of section "UD_main676_4" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_7" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_8" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_9" failed, relocating to a shared memory location.
warning: Relocation of section "UD_main676_0" failed, relocating to a shared memory location.
warning: Relocation of section "UD_main676_1" failed, relocating to a shared memory location.
warning: Relocation of section "UD_main676_2" failed, relocating to a shared memory location.
warning: Relocation of section "UD_main676_3" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_0" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_1" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_2" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_3" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_4" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_5" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_6" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_10" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_11" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_12" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_13" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_14" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_15" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_16" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_17" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_18" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_main676_19" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_idata_0" failed, relocating to a shared memory location.
 
C:\Users\useer\Desktop\16f676test2\New folder>pause 0
Press any key to continue . . .
Добавлено через 2 минуты
При компиляции первой программі:
Code
1
2
3
4
5
6
7
8
9
10
11
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0000] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0004] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x001E] has no section. (pass 0)
warning: Relocation symbol "_cinit" [0x0022] has no section. (pass 0)
warning: Relocation of section "UDL_idata_0" failed, relocating to a shared memory location.
warning: Relocation of section "UDL_main676_0" failed, relocating to a shared memory location.
warning: Relocation of section "IDD_idata_0" failed, relocating to a shared memory location.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
22.11.2021, 09:53
Помогаю со студенческими работами здесь

Динамическая компиляция (компиляция программы в программе)
Привет форумчане, встретился с такой проблемой,мне в курсовой работе сказали сделать чтобы с textBox программа считывала введённый текст,...

Компиляция программы
Всем привет. Вот с 14-30 сижу , накачал кучу прог , пробую разными способами никак не могу запустить свой код. Помагите пожалуйста! ...

Компиляция программы
Вопрос такой: хотелось бысь бы знать прикомпиляции программы1-й, второй раз, а потом дизасемблировании этих копий, копити наверное не будут...

Компиляция программы на Qt с g++
Здравствуйте, хотелось бы узнать, как можно без Qt Creator, qmake и clang'a построить Qt-приложение. Я видел, что на ранних версиях...

Компиляция программы
Читаю книжку Олега Калашникова. В принципе автор все хорошо объясняет, за исключением того, как скомпилировать ехе-файл!!!! Я скачал...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
Новые блоги и статьи
[Owen Logic] Поддержание уровня воды в резервуаре количеством включённых насосов: моделирование и выбор регулятора
ФедосеевПавел 14.03.2026
Поддержание уровня воды в резервуаре количеством включённых насосов: моделирование и выбор регулятора ВВЕДЕНИЕ Выполняя задание на управление насосной группой заполнения резервуара,. . .
делаю науч статью по влиянию грибов на сукцессию
anaschu 13.03.2026
прикрепляю статью
SDL3 для Desktop (MinGW): Создаём пустое окно с нуля для 2D-графики на SDL3, Си и C++
8Observer8 10.03.2026
Содержание блога Финальные проекты на Си и на C++: hello-sdl3-c. zip hello-sdl3-cpp. zip Результат:
Установка CMake и MinGW 13.1 для сборки С и C++ приложений из консоли и из Qt Creator в EXE
8Observer8 10.03.2026
Содержание блога MinGW - это коллекция инструментов для сборки приложений в EXE. CMake - это система сборки приложений. Здесь описаны базовые шаги для старта программирования с помощью CMake и. . .
Как дизайн сайта влияет на конверсию: 7 решений, которые реально повышают заявки
Neotwalker 08.03.2026
Многие до сих пор воспринимают дизайн сайта как “красивую оболочку”. На практике всё иначе: дизайн напрямую влияет на то, оставит человек заявку или уйдёт через несколько секунд. Даже если у вас. . .
Модульная разработка через nuget packages
DevAlt 07.03.2026
Сложившийся в . Net-среде способ разработки чаще всего предполагает монорепозиторий в котором находятся все исходники. При создании нового решения, мы просто добавляем нужные проекты и имеем. . .
Модульный подход на примере F#
DevAlt 06.03.2026
В блоге дяди Боба наткнулся на такое определение: В этой книге («Подход, основанный на вариантах использования») Ивар утверждает, что архитектура программного обеспечения — это структуры,. . .
Управление камерой с помощью скрипта OrbitControls.js на Three.js: Вращение, зум и панорамирование
8Observer8 05.03.2026
Содержание блога Финальная демка в браузере работает на Desktop и мобильных браузерах. Итоговый код: orbit-controls-threejs-js. zip. Сканируйте QR-код на мобильном. Вращайте камеру одним пальцем,. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru