From 8503f2d2d54823bee32ad753ef7da1252a7cb542 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Tue, 19 Jul 2022 15:38:54 +0100 Subject: [PATCH] Add avrdude.conf syntax opcode = NULL; for SPI programming --- src/config_gram.y | 28 ++++++++++++++++++++++++++++ src/lexer.l | 1 + 2 files changed, 29 insertions(+) diff --git a/src/config_gram.y b/src/config_gram.y index e2dd669a..0ca1d782 100644 --- a/src/config_gram.y +++ b/src/config_gram.y @@ -50,6 +50,8 @@ static int parse_cmdbits(OPCODE * op, int opnum); static int pin_name; %} +%token K_NULL; + %token K_READ %token K_WRITE %token K_READ_LO @@ -1326,6 +1328,19 @@ part_parm : } current_part->op[opnum] = op; + free_token($1); + } + } | + + opcode TKN_EQUAL K_NULL { + { + int opnum = which_opcode($1); + if(opnum < 0) + YYABORT; + if(current_part->op[opnum] != NULL) + avr_free_opcode(current_part->op[opnum]); + current_part->op[opnum] = NULL; + free_token($1); } } @@ -1473,6 +1488,19 @@ mem_spec : } current_mem->op[opnum] = op; + free_token($1); + } + } | + + opcode TKN_EQUAL K_NULL { + { + int opnum = which_opcode($1); + if(opnum < 0) + YYABORT; + if(current_mem->op[opnum] != NULL) + avr_free_opcode(current_mem->op[opnum]); + current_mem->op[opnum] = NULL; + free_token($1); } } diff --git a/src/lexer.l b/src/lexer.l index f2f4b2ce..91d02597 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -176,6 +176,7 @@ miso { yylval=NULL; return K_MISO; } mode { yylval=NULL; return K_MODE; } mosi { yylval=NULL; return K_MOSI; } no { yylval=new_token(K_NO); return K_NO; } +NULL { yylval=NULL; return K_NULL; } num_banks { yylval=NULL; return K_NUM_PAGES; } num_pages { yylval=NULL; return K_NUM_PAGES; } nvm_base { yylval=NULL; return K_NVM_BASE; }